csx преди 6 години
родител
ревизия
238bd11d68
променени са 44 файла, в които са добавени 11811 реда и са изтрити 226 реда
  1. 187 42
      src/api/stock.js
  2. 11 1
      src/lang/zh.js
  3. 165 2
      src/xt_pages/stock/Dialog/salesReturnDialog.vue
  4. 124 181
      src/xt_pages/stock/Dialog/stockInDialog.vue
  5. 23 0
      src/xt_pages/stock/cancelStockDetail.vue
  6. 406 0
      src/xt_pages/stock/cancelStockOrder.vue
  7. 407 0
      src/xt_pages/stock/cancelStockOrderAdd.vue
  8. 232 0
      src/xt_pages/stock/cancelStockOrderDetail.vue
  9. 391 0
      src/xt_pages/stock/cancelStockOrderEdit.vue
  10. 25 0
      src/xt_pages/stock/otherCancelStockDetail.vue
  11. 406 0
      src/xt_pages/stock/otherCancelStockOrder.vue
  12. 407 0
      src/xt_pages/stock/otherCancelStockOrderAdd.vue
  13. 232 0
      src/xt_pages/stock/otherCancelStockOrderDetail.vue
  14. 391 0
      src/xt_pages/stock/otherCancelStockOrderEdit.vue
  15. 24 0
      src/xt_pages/stock/otherSalesReturnDetail.vue
  16. 408 0
      src/xt_pages/stock/otherSalesReturnOrder.vue
  17. 413 0
      src/xt_pages/stock/otherSalesReturnOrderAdd.vue
  18. 232 0
      src/xt_pages/stock/otherSalesReturnOrderDetail.vue
  19. 391 0
      src/xt_pages/stock/otherSalesReturnOrderEdit.vue
  20. 24 0
      src/xt_pages/stock/otherStockInDetail.vue
  21. 506 0
      src/xt_pages/stock/otherStockInOrder.vue
  22. 611 0
      src/xt_pages/stock/otherStockInOrderAdd.vue
  23. 281 0
      src/xt_pages/stock/otherStockInOrderDetail.vue
  24. 502 0
      src/xt_pages/stock/otherStockInOrderEdit.vue
  25. 13 0
      src/xt_pages/stock/otherStockOutDetail.vue
  26. 13 0
      src/xt_pages/stock/otherStockOutOrder.vue
  27. 13 0
      src/xt_pages/stock/otherStockOutOrderAdd.vue
  28. 13 0
      src/xt_pages/stock/otherStockOutOrderDetail.vue
  29. 13 0
      src/xt_pages/stock/otherStockOutOrderEdit.vue
  30. 24 0
      src/xt_pages/stock/salesReturnDetail.vue
  31. 391 0
      src/xt_pages/stock/salesReturnEdit.vue
  32. 408 0
      src/xt_pages/stock/salesReturnOrder.vue
  33. 413 0
      src/xt_pages/stock/salesReturnOrderAdd.vue
  34. 232 0
      src/xt_pages/stock/salesReturnOrderDetail.vue
  35. 24 0
      src/xt_pages/stock/stockInDetail.vue
  36. 506 0
      src/xt_pages/stock/stockInOrder.vue
  37. 611 0
      src/xt_pages/stock/stockInOrderAdd.vue
  38. 281 0
      src/xt_pages/stock/stockInOrderDetail.vue
  39. 502 0
      src/xt_pages/stock/stockInOrderEdit.vue
  40. 24 0
      src/xt_pages/stock/stockOutDetail.vue
  41. 406 0
      src/xt_pages/stock/stockOutOrder.vue
  42. 442 0
      src/xt_pages/stock/stockOutOrderAdd.vue
  43. 258 0
      src/xt_pages/stock/stockOutOrderDetail.vue
  44. 425 0
      src/xt_pages/stock/stockOutOrderEdit.vue

+ 187 - 42
src/api/stock.js Целия файл

@@ -251,9 +251,9 @@ export function GetAllGoodInfo(params){
251 251
   })
252 252
 }
253 253
 
254
-export function postWarehouse(params,warehousing_time,warehousing_order){
254
+export function postWarehouse(params,warehousing_time,manufacturer_id,dealer_id){
255 255
   return request({
256
-    url:'/api/stock/warehouse/create?warehousing_time='+warehousing_time+"&warehousing_order="+warehousing_order,
256
+    url:'/api/stock/warehouse/create?warehousing_time='+warehousing_time+"&manufacturer_id="+manufacturer_id+"&dealer_id="+dealer_id,
257 257
     method:'post',
258 258
     data:params
259 259
   })
@@ -277,9 +277,9 @@ export function getWarehouseInfoList(params){
277 277
 }
278 278
 
279 279
 
280
-export function postSalesReturn(params,salesReturnTime,salesReturnTotal,ids,orderNumber){
280
+export function postSalesReturn(params,salesReturnTime,salesReturnTotal,dealer_id,manufacturer_id){
281 281
   return request({
282
-    url:'/api/warehouse/return?time='+salesReturnTime+"&total="+salesReturnTotal+"&ids="+ids+"&order_number="+orderNumber,
282
+    url:'/api/warehouse/return?time='+salesReturnTime+"&total="+salesReturnTotal+"&dealer_id="+dealer_id+"&manufacturer_id="+manufacturer_id,
283 283
     method:'post',
284 284
     data:params
285 285
   })
@@ -324,15 +324,6 @@ export function getAllWarehouseInfo(params){
324 324
 
325 325
 
326 326
 
327
-
328
-export function getWarehouseOutList(params){
329
-  return request({
330
-    url:'/api/stock/out/list',
331
-    method:'get',
332
-    params:params
333
-  })
334
-}
335
-
336 327
 export function getWarehouseOutInfoList(params){
337 328
   return request({
338 329
     url:'/api/stock/out/info',
@@ -342,9 +333,9 @@ export function getWarehouseOutInfoList(params){
342 333
 }
343 334
 
344 335
 
345
-export function postWarehouseOut(params,warehousing_time,warehousing_out_order){
336
+export function postWarehouseOut(params,warehousing_time,dealer_id,manufacturer_id){
346 337
   return request({
347
-    url:'/api/stock/out/create?warehousing_out_time='+warehousing_time+"&warehousing_out_order="+warehousing_out_order,
338
+    url:'/api/warehouseout/create?warehousing_out_time='+warehousing_time+"&dealer_id="+dealer_id+"&manufacturer_id="+manufacturer_id,
348 339
     method:'post',
349 340
     data:params
350 341
   })
@@ -367,33 +358,9 @@ export function getWarehouseInfoByGoodTypeId(params){
367 358
   })
368 359
 }
369 360
 
370
-export function getWarehouseOutInfo(params){
371
-  return request({
372
-    url:'/api/out/info',
373
-    method:'get',
374
-    params:params
375
-  })
376
-}
377
-
378 361
 
379
-export function postCancelStock(params,cancelStockTime,cancelStockTotal,ids,orderNumber){
380
-  return request({
381
-    url:'/api/stock/cancel?time='+cancelStockTime+"&total="+cancelStockTotal+"&ids="+ids+"&order_number="+orderNumber,
382
-    method:'post',
383
-    data:params
384
-  })
385
-}
386 362
 
387 363
 
388
-
389
-export function getCancelStockList(params){
390
-  return request({
391
-    url:'/api/cancel/list',
392
-    method:'get',
393
-    params:params
394
-  })
395
-}
396
-
397 364
 export function getCancelStockInfoList(params){
398 365
   return request({
399 366
     url:'/api/cancel/info',
@@ -467,30 +434,208 @@ export function modifyWarehouseOutInfo(params){
467 434
 }
468 435
 
469 436
 
437
+
438
+
439
+
440
+export function deleteStockInRecord(params){
441
+  return request({
442
+    url:'/api/warehouse/delete',
443
+    method:'post',
444
+    params:params
445
+  })
446
+}
447
+
448
+
449
+export function GetAllConfig(){
450
+  return request({
451
+    url:'/api/stock/config',
452
+    method:'get',
453
+  })
454
+}
455
+
456
+export function GetAllGoodInfoByID(params){
457
+  return request({
458
+    url:'/api/good/get',
459
+    method:'get',
460
+    params:params
461
+
462
+  })
463
+}
464
+
465
+
466
+export function DeleteWarehouseInfoItem(params){
467
+  return request({
468
+    url:'/api/stock/warehouseinfo/delete',
469
+    method:'post',
470
+    params:params
471
+
472
+  })
473
+}
474
+
475
+
476
+
477
+export function EditWarehouse(params,warehousing_time,id){
478
+  return request({
479
+    url:'/api/stock/warehouse/edit?warehousing_time='+warehousing_time+'&id='+id,
480
+    method:'post',
481
+    data:params
482
+  })
483
+}
484
+
485
+
486
+export function getSalesReturnConfig(){
487
+  return request({
488
+    url:'/api/return/config',
489
+    method:'get',
490
+  })
491
+}
492
+
493
+export function deleteSalesReturn(params){
494
+  return request({
495
+    url:'/api/return/delete',
496
+    method:'post',
497
+    params:params
498
+  })
499
+}
500
+
501
+
502
+export function getSaleReturnInfoList(params){
503
+  return request({
504
+    url:'/api/stock/salesReturn/list',
505
+    method:'get',
506
+    params:params
507
+  })
508
+}
509
+
510
+
511
+export function getReturnList(params){
512
+  return request({
513
+    url:'/api/return/info/list',
514
+    method:'get',
515
+    params:params
516
+  })
517
+}
518
+export function deleteSalesReturnInfo(params){
519
+  return request({
520
+    url:'/api/return/info/delete',
521
+    method:'post',
522
+    params:params
523
+  })
524
+}
525
+
526
+
527
+
528
+export function editSalesReturnInfo(params,return_time,id){
529
+  return request({
530
+    url:'/api/return/edit?return_time='+return_time+"&id="+id,
531
+    method:'post',
532
+    data:params
533
+  })
534
+}
535
+
536
+
537
+export function deleteWarehouseOut(params){
538
+  return request({
539
+    url:'/api/warehouseout/delete',
540
+    method:'post',
541
+    params:params
542
+  })
543
+}
544
+
470 545
 export function deleteWarehouseOutInfo(params){
471 546
   return request({
472
-    url:'/api/stock/out/delete',
547
+    url:'/api/warehouseoutinfo/delete',
473 548
     method:'post',
474 549
     params:params
475 550
   })
476 551
 }
477 552
 
478 553
 
479
-export function deleteStockInRecord(params){
554
+export function getWarehouseOutList(params){
480 555
   return request({
481
-    url:'/api/warehouse/delete',
556
+    url:'/api/warehouseout/list',
557
+    method:'get',
558
+    params:params
559
+  })
560
+}
561
+
562
+export function getWarehouseOutInfo(params){
563
+  return request({
564
+    url:'/api/warehouseout/info',
565
+    method:'get',
566
+    params:params
567
+  })
568
+}
569
+
570
+
571
+export function editWarehouseoutInfo(params,warehouse_out_time,id){
572
+  return request({
573
+    url:'/api/warehouseout/edit?warehouse_out_time='+warehouse_out_time+"&id="+id,
482 574
     method:'post',
575
+    data:params
576
+  })
577
+}
578
+
579
+
580
+
581
+
582
+export function getCancelStockList(params){
583
+  return request({
584
+    url:'/api/cancelstock/list',
585
+    method:'get',
483 586
     params:params
484 587
   })
485 588
 }
486 589
 
487 590
 
488 591
 
592
+export function editCancelStockInfo(params,cancel_stock_time,id){
593
+  return request({
594
+    url:'/api/cancelstockinfo/edit?cancel_time='+cancel_stock_time+"&id="+id,
595
+    method:'post',
596
+    data:params
597
+  })
598
+}
599
+
489 600
 
601
+export function getCancelStockInfo(params){
602
+  return request({
603
+    url:'/api/cancelstock/info',
604
+    method:'get',
605
+    params:params
606
+  })
607
+}
490 608
 
491 609
 
492 610
 
611
+export function deleteCancelStock(params){
612
+  return request({
613
+    url:'/api/cancelstock/delete',
614
+    method:'post',
615
+    params:params
616
+  })
617
+}
493 618
 
619
+export function deleteCancelStockInfo(params){
620
+  return request({
621
+    url:'/api/cancelstockinfo/delete',
622
+    method:'post',
623
+    params:params
624
+  })
625
+}
494 626
 
627
+export function postCancelStock(params,cancelStockTime,manufacturer_id,dealer_id){
628
+  return request({
629
+    url:'/api/cancelstock/create?time='+cancelStockTime+"&manufacturer_id="+manufacturer_id+"&dealer_id="+dealer_id,
630
+    method:'post',
631
+    data:params
632
+  })
633
+}
634
+export function getCancelStockConfig(){
635
+  return request({
636
+    url:'/api/cancelstockinfo/config',
637
+    method:'get',
638
+  })
639
+}
495 640
 
496 641
 

+ 11 - 1
src/lang/zh.js Целия файл

@@ -136,6 +136,16 @@ export default {
136 136
     special_permission_manage: "特殊权限管理",
137 137
     schedule_print: "排班打印",
138 138
     dialysis_batch_print: "批量打印",
139
+    stockInOrder:"入库单",
140
+    salesReturnOrder:"退货单",
141
+    stockOutOrder:"出库单",
142
+    cancelStockOrder:"出库退库单",
143
+    otherStockInOrder:"其他入库单",
144
+    otherSalesReturnOrder:"其退货单",
145
+    otherStockOutOrder:"其他出库单",
146
+    otherCancelStockOrder:"其他出库退库单",
147
+
148
+
139 149
   },
140 150
   navbar: {
141 151
     logOut: '退出登录',
@@ -198,7 +208,7 @@ export default {
198 208
     draft: '草稿',
199 209
     delete: '删除',
200 210
     cancel: '取 消',
201
-    confirm: '确 定'
211
+    confirm: '保 存'
202 212
   },
203 213
   errorLog: {
204 214
     tips: '请点击右上角bug小图标',

+ 165 - 2
src/xt_pages/stock/Dialog/salesReturnDialog.vue Целия файл

@@ -1,11 +1,174 @@
1 1
 <template>
2
+  <el-dialog :title="propForm.title" :visible.sync="visibility" :show-close="isClose" :close-on-click-modal="isClose"
3
+             :close-on-press-escape="isClose">
4
+
5
+    <div class="filter-container">
6
+      <el-input style="width: 150px;" class="filter-item" placeholder="规格名称" v-model="keywords"/>
7
+      <el-button class="filter-item" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
8
+    </div>
9
+
10
+    <el-row :gutter="20">
11
+      <el-col :span="8">
12
+        <el-table
13
+          :data="propForm.goodType"
14
+          ref="templatetable"
15
+          border
16
+          highlight-current-row
17
+          max-height="250"
18
+          @current-change="goodTypeTableChange"
19
+          style="width: 100%">
20
+          <el-table-column
21
+            prop="type_name"
22
+            label="商品类型">
23
+          </el-table-column>
24
+        </el-table>
25
+      </el-col>
26
+      <el-col :span="16">
27
+        <el-table
28
+          :data="goodInfoTableData"
29
+          border
30
+          ref="multipleTable"
31
+          max-height="250"
32
+          @selection-change="changeGoodInfoTableData"
33
+          @select-all="changeAllGoodInfoTableData"
34
+          row-key="row_key"
35
+          style="width: 100%"
36
+        >
37
+          <el-table-column
38
+            type="selection"
39
+            width="55">
40
+          </el-table-column>
41
+          <el-table-column
42
+            label="规格名称"
43
+            property="specification_name"
44
+            style="word-break: keep-all;white-space:nowrap;"
45
+          ></el-table-column>
46
+          <el-table-column
47
+            label="单位"
48
+            property="good_unit"
49
+          >
50
+            <template slot-scope="scope">
51
+              <span>{{getName(scope.row.good_unit)}}</span>
52
+            </template>
53
+          </el-table-column>
54
+
55
+        </el-table>
56
+      </el-col>
57
+    </el-row>
58
+
59
+
60
+    <span slot="footer" class="dialog-footer">
61
+    <el-button @click="cancle()">取 消</el-button>
62
+    <el-button type="primary" @click="comfirm()">确 定</el-button>
63
+  </span>
64
+  </el-dialog>
2 65
 
3 66
 </template>
4 67
 
5 68
 <script>
6
-    export default {
7
-        name: "sales-return-dialog"
69
+
70
+  export default {
71
+    name: 'salesReturnDialog',
72
+    data() {
73
+      return {
74
+        goodInfo: [],
75
+        goodInfoTableData: [],
76
+        keywords: '',
77
+        multipleSelection: [],
78
+        currentGoodTypeId: 0,
79
+        isClose : false
80
+      }
81
+    },
82
+    props: {
83
+      propForm: {
84
+        type: Object
85
+      },
86
+      visibility: {
87
+        type: Boolean,
88
+        default: false
89
+      }
90
+
91
+    },
92
+    methods: {
93
+      goodTypeTableChange: function(currentRow, oldCurrentRow) {
94
+        this.currentGoodTypeId = currentRow.id
95
+
96
+        this.goodInfoTableData = []
97
+        this.goodInfo = []
98
+        for (let i = 0; i < this.propForm.goodInfo.length; i++) {
99
+          if(this.currentGoodTypeId == this.propForm.goodInfo[i].good_type_id){
100
+            this.goodInfo.push(this.propForm.goodInfo[i])
101
+            this.goodInfoTableData.push(this.propForm.goodInfo[i])
102
+          }
103
+        }
104
+      },
105
+      cancle: function() {
106
+        this.$emit('dialog-cancle', this.getValue())
107
+        this.$refs.multipleTable.clearSelection();
108
+      },
109
+      comfirm: function() {
110
+        this.$emit('dialog-comfirm', this.getValue())
111
+        this.$refs.multipleTable.clearSelection();
112
+
113
+      },
114
+      getValue: function() {
115
+        let obj = {
116
+          selectedGoodInfo: this.multipleSelection,
117
+          goodTypeId: this.currentGoodTypeId
118
+        }
119
+        return obj
120
+      }, goodTypeSelect: function(id) {
121
+
122
+        this.tempGoodInfo = []
123
+        this.goodInfo = []
124
+        for (let i = 0; i < this.propForm.goodInfo.length; i++) {
125
+          if (this.propForm.goodInfo[i].good_type_id == id) {
126
+            this.tempGoodInfo.push(this.propForm.goodInfo[i])
127
+          }
128
+        }
129
+      }, goodInfoSelect: function(id) {
130
+        let index = 0
131
+        for (let i = 0; i < this.propForm.goodInfo.length; i++) {
132
+          if (this.propForm.goodInfo[i].id == id) {
133
+            index = i
134
+          }
135
+        }
136
+        this.form.good_type_id = this.propForm.goodInfo[index].good_type_id
137
+      }, getName: function(id) {
138
+        if (id == 0) {
139
+          return ''
140
+        }
141
+
142
+        for (let i = 0; i < this.propForm.goodUnit.length; i++) {
143
+          if (this.propForm.goodUnit[i].id == id) {
144
+            return this.propForm.goodUnit[i].name
145
+          }
146
+        }
147
+      }, search: function() {
148
+        if (this.keywords.length <= 0) {
149
+          this.$message.error('搜索关键字不能为空')
150
+          return
151
+        }
152
+        let searchArr = []
153
+        for (let i = 0; i < this.goodInfoTableData.length; i++) {
154
+          if (this.goodInfoTableData[i].specification_name.indexOf(this.keywords) != -1) {
155
+            searchArr.push(this.goodInfoTableData[i])
156
+          }
157
+        }
158
+        this.goodInfoTableData = []
159
+        for (let i = 0; i < searchArr.length; i++) {
160
+          this.goodInfoTableData.push(searchArr[i])
161
+        }
162
+      }, changeGoodInfoTableData: function(val) {
163
+        this.multipleSelection = val
164
+
165
+      }, changeAllGoodInfoTableData: function(val) {
166
+        this.multipleSelection = val
167
+
168
+      }
8 169
     }
170
+  }
171
+
9 172
 </script>
10 173
 
11 174
 <style scoped>

+ 124 - 181
src/xt_pages/stock/Dialog/stockInDialog.vue Целия файл

@@ -2,142 +2,82 @@
2 2
   <el-dialog :title="propForm.title" :visible.sync="visibility" :show-close="isClose" :close-on-click-modal="isClose"
3 3
              :close-on-press-escape="isClose">
4 4
 
5
-    <el-form  class="demo-form-inline" style="height: 300px"
6
-              :rules="rules" :model="form" ref="form"
7
-             label-width="140px">
8
-      <el-col :span="size">
9
-        <el-form-item label="物品类型:" prop="good_type_id">
10
-          <el-select v-model="form.good_type_id" placeholder="请选择"     @change="goodTypeSelect"
11
-          >
12
-            <el-option
13
-              v-for="item in tempGoodType"
14
-              :key="item.id"
15
-              :label="item.type_name"
16
-              :value="item.id">
17
-            </el-option>
18
-          </el-select>
19
-        </el-form-item>
20
-      </el-col>
21
-
22
-
23
-      <el-col :span="size">
24
-        <el-form-item label="规格名称:" prop="good_id">
25
-          <el-select v-model="form.good_id" placeholder="请选择"  @change="goodInfoSelect">
26
-            <el-option
27
-              v-for="item in tempGoodInfo"
28
-
29
-              :key="item.id"
30
-              :label="item.specification_name"
31
-              :value="item.id">
32
-            </el-option>
33
-          </el-select>
34
-        </el-form-item>
35
-      </el-col>
36
-
37
-      <el-col :span="size">
38
-        <el-form-item label="批号:" prop="number">
39
-          <el-input v-model="form.number"></el-input>
40
-        </el-form-item>
41
-      </el-col>
42
-
43
-
44
-      <el-col :span="size">
45
-        <el-form-item label="生产日期:" prop="product_date">
46
-          <el-date-picker v-model="form.product_date" prefix-icon="el-icon-date" :editable="false"
47
-                          style="width: 173px;"
48
-                          type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
49
-                          value-format="yyyy-MM-dd"></el-date-picker>
50
-        </el-form-item>
51
-      </el-col>
52
-
53
-      <el-col :span="size">
54
-
55
-        <el-form-item label="有效日期:" prop="expiry_date">
56
-          <el-date-picker v-model="form.expiry_date" prefix-icon="el-icon-date" :editable="false"
57
-                          style="width: 173px;"
58
-                          type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
59
-                          value-format="yyyy-MM-dd"></el-date-picker>
60
-        </el-form-item>
61
-
62
-
63
-      </el-col>
64
-
65
-
66
-      <el-col :span="size">
67
-        <el-form-item label="入库数量:" prop="warehousing_count">
68
-          <el-input type="number" v-model="form.warehousing_count"></el-input>
69
-        </el-form-item>
70
-      </el-col>
71
-
72
-      <el-col :span="size">
73
-        <el-form-item label="物品单价:" prop="price">
74
-          <el-input type="number"  v-model="form.price"></el-input>
75
-        </el-form-item>
5
+    <div class="filter-container">
6
+      <el-input style="width: 150px;" class="filter-item" placeholder="规格名称" v-model="keywords"/>
7
+      <el-button class="filter-item" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
8
+    </div>
9
+
10
+    <el-row :gutter="20">
11
+      <el-col :span="8">
12
+        <el-table
13
+          :data="propForm.goodType"
14
+          ref="templatetable"
15
+          border
16
+          highlight-current-row
17
+          max-height="250"
18
+          @current-change="goodTypeTableChange"
19
+          style="width: 100%">
20
+          <el-table-column
21
+            prop="type_name"
22
+            label="商品类型">
23
+          </el-table-column>
24
+        </el-table>
76 25
       </el-col>
26
+      <el-col :span="16">
27
+        <el-table
28
+          :data="goodInfoTableData"
29
+          border
30
+          ref="multipleTable"
31
+          max-height="250"
32
+          @selection-change="changeGoodInfoTableData"
33
+          @select-all="changeAllGoodInfoTableData"
34
+          row-key="row_key"
35
+          style="width: 100%"
36
+        >
37
+          <el-table-column
38
+            type="selection"
39
+            width="55">
40
+          </el-table-column>
41
+          <el-table-column
42
+            label="规格名称"
43
+            property="specification_name"
44
+            style="word-break: keep-all;white-space:nowrap;"
45
+          ></el-table-column>
46
+          <el-table-column
47
+            label="单位"
48
+            property="good_unit"
49
+          >
50
+            <template slot-scope="scope">
51
+              <span>{{getName(scope.row.good_unit)}}</span>
52
+            </template>
53
+          </el-table-column>
77 54
 
78
-      <el-col>
79
-        <el-form-item label="备注 : " prop="remark">
80
-          <el-input type="textarea" :row="5" v-model="form.remark"
81
-                    placeholder="请输入内容">
82
-          </el-input>
83
-        </el-form-item>
55
+        </el-table>
84 56
       </el-col>
85
-    </el-form>
57
+    </el-row>
86 58
 
87 59
 
88 60
     <span slot="footer" class="dialog-footer">
89
-    <el-button v-if="propForm.isCreated == 3" @click="cancle('form')">取 消</el-button>
90
-    <el-button v-if="propForm.isCreated != 3 " @click="cancle('form')">取 消</el-button>
91
-    <el-button v-if="propForm.isCreated != 3" type="primary" @click="comfirm('form')">确 定</el-button>
61
+    <el-button @click="cancle('form')">取 消</el-button>
62
+    <el-button type="primary" @click="comfirm('form')">确 定</el-button>
92 63
   </span>
93 64
   </el-dialog>
94 65
 
95 66
 </template>
96 67
 
97 68
 <script>
69
+  import { GetGoodInfoByGoodId } from '@/api/stock'
70
+
98 71
   export default {
99
-    name: "stockInDialog",
72
+    name: 'stockInDialog',
100 73
     data() {
101 74
       return {
102
-        form:{
103
-          good_type_id: '',
104
-          good_id: '',
105
-          number: '',
106
-          product_date: '',
107
-          expiry_date: '',
108
-          warehousing_count: '',
109
-          price: '',
110
-          remark: '',
111
-          dealer: '',
112
-          manufacturer: '',
113
-        },
114
-        tempGoodType: [],
115
-        tempGoodInfo: [],
116
-        isClose: false,
117
-        size: 11,
118
-        isShow: true,
119
-        rules: {
120
-          good_id: [
121
-            {required: true, message: '请选择物品类型', trigger: 'change'}
122
-          ],
123
-          good_type_id: [
124
-            {required: true, message: '请选择规格名称', trigger: 'change'}
125
-          ],
126
-          number: [
127
-            {required: true, message: '请输入批号', trigger: 'blur'}
128
-          ],
129
-          expiry_date: [
130
-            {required: true, message: '请选择日期', trigger: 'change'}
131
-          ],
132
-          warehousing_count: [
133
-            {required: true, message: '请选择入库数量', trigger: 'blur'}
134
-          ],
135
-          price: [
136
-            {required: true, message: '请选择物品单价', trigger: 'blur'}
137
-          ],
138
-
139
-
140
-        }
75
+        goodInfo: [],
76
+        goodInfoTableData: [],
77
+        keywords: '',
78
+        multipleSelection: [],
79
+        currentGoodTypeId: 0,
80
+        isClose : false
141 81
       }
142 82
     },
143 83
     props: {
@@ -147,90 +87,93 @@
147 87
       visibility: {
148 88
         type: Boolean,
149 89
         default: false
150
-      },
90
+      }
151 91
 
152 92
     },
153 93
     methods: {
154
-      cancle: function (formName) {
155
-        this.$emit('dialog-cancle', this.getValue());
156
-        this.$refs[formName].resetFields();
157
-      },
158
-      comfirm: function (formName) {
159
-        this.$refs[formName].validate((valid) => {
160
-          if (valid) {
161
-            this.$emit('dialog-comfirm', this.getValue());
162
-
163
-          }
164
-        });
165
-      },
166
-      getValue: function () {
167
-        let form = {}
168
-        form['good_type_id'] = this.form.good_type_id
169
-        form['good_id'] = this.form.good_id
170
-        form['number'] = this.form.number
171
-        form['product_date'] = this.form.product_date
172
-        form['expiry_date'] = this.form.expiry_date
173
-        form['warehousing_count'] = this.form.warehousing_count
174
-        form['price'] = this.form.price
175
-        if(this.form.remark == undefined){
176
-          form['remark'] = ""
177
-        }else{
178
-          form['remark'] = this.form.remark
94
+      goodTypeTableChange: function(currentRow, oldCurrentRow) {
95
+        this.currentGoodTypeId = currentRow.id
96
+        let params = {
97
+          id: currentRow.id
179 98
         }
180
-
181
-        console.log(form['remark'])
182
-        form['isCreated'] = this.propForm.isCreated
183
-        for(let i = 0; i <this.propForm.goodInfo.length; i++){
184
-
185
-          if(this.propForm.goodInfo[i].id == this.propForm.formValue.good_id){
186
-
187
-            form['dealer'] = this.propForm.goodInfo[i].dealer
188
-            form['manufacturer'] = this.propForm.goodInfo[i].manufacturer
99
+        this.goodInfoTableData = []
100
+        this.goodInfo = []
101
+        GetGoodInfoByGoodId(params).then(response => {
102
+          if (response.data.state == 0) {
103
+            this.$message.error(response.data.msg)
104
+            return false
105
+          } else {
106
+            for (let i = 0; i < response.data.data.list.length; i++) {
107
+              this.goodInfo.push(response.data.data.list[i])
108
+              this.goodInfoTableData.push(response.data.data.list[i])
109
+            }
189 110
           }
190
-        }
111
+        })
191 112
 
113
+      },
114
+      cancle: function(formName) {
115
+        this.$emit('dialog-cancle', this.getValue())
116
+        this.$refs.multipleTable.clearSelection();
117
+      },
118
+      comfirm: function(formName) {
119
+        this.$emit('dialog-comfirm', this.getValue())
120
+        this.$refs.multipleTable.clearSelection();
192 121
 
193
-        return form
194
-      }, goodTypeSelect: function (id) {
122
+      },
123
+      getValue: function() {
124
+        let obj = {
125
+          selectedGoodInfo: this.multipleSelection,
126
+          goodTypeId: this.currentGoodTypeId
127
+        }
128
+        return obj
129
+      }, goodTypeSelect: function(id) {
195 130
 
196 131
         this.tempGoodInfo = []
132
+        this.goodInfo = []
197 133
         for (let i = 0; i < this.propForm.goodInfo.length; i++) {
198 134
           if (this.propForm.goodInfo[i].good_type_id == id) {
199 135
             this.tempGoodInfo.push(this.propForm.goodInfo[i])
200 136
           }
201 137
         }
202
-      }, goodInfoSelect: function (id) {
203
-        let index = 0;
138
+      }, goodInfoSelect: function(id) {
139
+        let index = 0
204 140
         for (let i = 0; i < this.propForm.goodInfo.length; i++) {
205 141
           if (this.propForm.goodInfo[i].id == id) {
206 142
             index = i
207 143
           }
208 144
         }
209 145
         this.form.good_type_id = this.propForm.goodInfo[index].good_type_id
210
-      }
211
-    },
212
-    watch: {
213
-      visibility(val) {
214
-        this.form = this.propForm.formValue
215
-        this.tempGoodInfo = this.propForm.goodInfo
216
-        this.tempGoodType = this.propForm.goodType
217
-        if(!val) {
218
-          this.form.good_type_id = ''
219
-          this.form.good_id = ''
220
-          this.form.number = ''
221
-          this.form.product_date = ''
222
-          this.form.expiry_date = ''
223
-          this.form.warehousing_count = ''
224
-          this.form.product_date = ''
225
-          this.form.price = ''
226
-          this.form.remark = ''
146
+      }, getName: function(id) {
147
+        if (id == 0) {
148
+          return ''
149
+        }
227 150
 
151
+        for (let i = 0; i < this.propForm.goodUnit.length; i++) {
152
+          if (this.propForm.goodUnit[i].id == id) {
153
+            return this.propForm.goodUnit[i].name
154
+          }
155
+        }
156
+      }, search: function() {
157
+        if (this.keywords.length <= 0) {
158
+          this.$message.error('搜索关键字不能为空')
159
+          return
160
+        }
161
+        let searchArr = []
162
+        for (let i = 0; i < this.goodInfoTableData.length; i++) {
163
+          if (this.goodInfoTableData[i].specification_name.indexOf(this.keywords) != -1) {
164
+            searchArr.push(this.goodInfoTableData[i])
165
+          }
166
+        }
167
+        this.goodInfoTableData = []
168
+        for (let i = 0; i < searchArr.length; i++) {
169
+          this.goodInfoTableData.push(searchArr[i])
228 170
         }
229
-        !val && setTimeout(() => {
230
-          this.$refs['form'].resetFields();
171
+      }, changeGoodInfoTableData: function(val) {
172
+        this.multipleSelection = val
231 173
 
174
+      }, changeAllGoodInfoTableData: function(val) {
175
+        this.multipleSelection = val
232 176
 
233
-        }, 0);
234 177
       }
235 178
     }
236 179
   }

+ 23 - 0
src/xt_pages/stock/cancelStockDetail.vue Целия файл

@@ -0,0 +1,23 @@
1
+<template>
2
+  <cancel-stock-order-detail v-if="isEdit == 0"   v-on:edit-record="isEdit = 1"></cancel-stock-order-detail>
3
+  <cancel-stock-order-edit v-else></cancel-stock-order-edit>
4
+</template>
5
+
6
+<script>
7
+  import CancelStockOrderDetail from './cancelStockOrderDetail'
8
+  import CancelStockOrderEdit from './cancelStockOrderEdit'
9
+  export default {
10
+    name: 'cancelStockDetail',
11
+    components: { CancelStockOrderEdit, CancelStockOrderDetail },
12
+    data() {
13
+      return {
14
+        isEdit: 0
15
+      }
16
+    },
17
+  }
18
+
19
+</script>
20
+
21
+<style scoped>
22
+
23
+</style>

+ 406 - 0
src/xt_pages/stock/cancelStockOrder.vue Целия файл

@@ -0,0 +1,406 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+
6
+    <div class="filter-container">
7
+
8
+
9
+      <el-row style="float:right;">
10
+        <el-button @click="AddNewOrder" type="primary">新增</el-button>
11
+      </el-row>
12
+    </div>
13
+
14
+    <div class="filter-container" style="margin-top:20px">
15
+      <el-input style="width: 300px;" class="filter-item" placeholder="单据日期/单据编码/制单人/供应商"/>
16
+      <el-button class="filter-item" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
17
+    </div>
18
+
19
+    <div class="filter-container">
20
+      <span>入库时间:</span>
21
+      <el-date-picker v-model="start_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
22
+                      type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
23
+                      value-format="yyyy-MM-dd" @change="startTimeChange"></el-date-picker>
24
+      <span class="">-</span>
25
+      <el-date-picker v-model="end_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
26
+                      type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
27
+                      value-format="yyyy-MM-dd" @change="endTimeChange"></el-date-picker>
28
+    </div>
29
+
30
+    <div class="filter-container" style="margin-top: 10px">
31
+      <el-checkbox style="width: 30px" v-model="checked" @change="changeAllSelected">全选</el-checkbox>
32
+      <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
33
+
34
+    </div>
35
+
36
+    <el-row :gutter="12" style="margin-top: 10px">
37
+      <el-table
38
+        :data="cancelStockDate"
39
+        :class="signAndWeighBoxPatients"
40
+        style="width: 100%" border
41
+        highlight-current-row
42
+        ref="multipleTable"
43
+        @selection-change="select"
44
+
45
+      >
46
+        <el-table-column
47
+          type="selection"
48
+          width="55">
49
+        </el-table-column>
50
+
51
+        <el-table-column label="单据日期" align="center">
52
+          <template slot-scope="scope">
53
+            {{ scope.row.return_time | parseTime('{y}-{m}-{d}')}}
54
+          </template>
55
+        </el-table-column>
56
+
57
+        <el-table-column label="单据编号" align="center">
58
+          <template slot-scope="scope">
59
+            {{scope.row.order_number}}
60
+          </template>
61
+        </el-table-column>
62
+
63
+        <el-table-column label="制单人" align="center">
64
+          <template slot-scope="scope">
65
+            {{getXuserName(scope.row.creater)}}
66
+          </template>
67
+        </el-table-column>
68
+
69
+
70
+        <el-table-column label="厂家" align="center">
71
+          <template slot-scope="scope">
72
+            {{getManufactuerName(scope.row.manufacturer)}}
73
+          </template>
74
+        </el-table-column>
75
+
76
+        <el-table-column label="经销商" align="center">
77
+          <template slot-scope="scope">
78
+            {{getDealerName(scope.row.dealer)}}
79
+          </template>
80
+        </el-table-column>
81
+
82
+        <el-table-column label="操作" align="center">
83
+          <template slot-scope="scope">
84
+            <el-button
85
+              size="mini"
86
+              type="primary"
87
+              icon="el-icon-edit"
88
+              @click="handleEdit(scope.$index, scope.row)">
89
+            </el-button>
90
+
91
+            <el-button
92
+              size="mini"
93
+              type="danger"
94
+              icon="el-icon-delete"
95
+              @click="handleDelete(scope.$index, scope.row)">
96
+            </el-button>
97
+
98
+          </template>
99
+        </el-table-column>
100
+
101
+      </el-table>
102
+
103
+      <el-pagination
104
+        @size-change="handleSizeChange"
105
+        @current-change="handleCurrentChange"
106
+        :page-sizes="[7]"
107
+        :page-size="7"
108
+        background
109
+        style="margin-top:20px;float: right"
110
+        layout="total, sizes, prev, pager, next, jumper"
111
+        :total="total">
112
+      </el-pagination>
113
+
114
+    </el-row>
115
+  </div>
116
+</template>
117
+
118
+<script>
119
+  import { uParseTime } from '@/utils/tools'
120
+  import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from '@/api/doctor'
121
+  import {
122
+    deleteCancelStock,
123
+    GetAllConfig,
124
+    getCancelStockList,
125
+  } from '@/api/stock'
126
+
127
+  export default {
128
+    name: 'salesReturnOrder',
129
+    created() {
130
+      var year = new Date().getFullYear()
131
+      var month = new Date().getMonth() + 1
132
+      var day = new Date().getDate()
133
+      if (parseInt(month) < 10) {
134
+        month = '0' + month
135
+      }
136
+      if (parseInt(day) < 10) {
137
+        day = '0' + day
138
+      }
139
+      const endTime = year + '-' + month + '-' + day
140
+      this.end_time = endTime
141
+
142
+      var year = new Date().getFullYear()
143
+      var month = new Date().getMonth()
144
+      var day = new Date().getDate()
145
+      if (parseInt(month) < 10) {
146
+        month = '0' + month
147
+      }
148
+      if (parseInt(day) < 10) {
149
+        day = '0' + day
150
+      }
151
+      const startTime = year + '-' + month + '-' + day
152
+      this.start_time = startTime
153
+      this.GetCancelStock()
154
+      this.GetConfigInfo()
155
+      this.fetchAllAdminUsers()
156
+    },
157
+    data() {
158
+      return {
159
+        page: 1,
160
+        limit: 7,
161
+        checked: false,
162
+        total: 0,
163
+        pageTotal: 0,
164
+        pageSelect: 0,
165
+        adminUserOptions: [],
166
+        multipleSelection: [],
167
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
168
+        start_time: '',
169
+        cancelStockDate: [],
170
+        end_time: '',
171
+        goodType: [],
172
+        goodInfo: [],
173
+        manufacturer: [],
174
+        selectedTableData: [],
175
+        dealer: [],
176
+
177
+      }
178
+    },
179
+    methods: {
180
+      AddNewOrder:function(){
181
+        this.$router.push({ name: 'cancelStockOrderAdd'})
182
+      },
183
+      GetCancelStock: function() {
184
+        const Params = {
185
+          page: this.page,
186
+          limit: this.limit,
187
+          start_time: this.start_time,
188
+          end_time: this.end_time
189
+        }
190
+        this.cancelStockDate = []
191
+        getCancelStockList(Params).then(response => {
192
+          if (response.data.state == 0) {
193
+            this.$message.error(response.data.msg)
194
+            return false
195
+          } else {
196
+            this.total = response.data.data.total
197
+            for (let i = 0; i < response.data.data.list.length; i++) {
198
+              this.cancelStockDate.push(response.data.data.list[i])
199
+            }
200
+          }
201
+        })
202
+      }, getXuserName(id) {
203
+        if (id <= 0) {
204
+          return ''
205
+        }
206
+        var name = ''
207
+        if (this.adminUserOptions == null || typeof (this.adminUserOptions.length) === 'undefined') {
208
+          return name
209
+        }
210
+        var leng = this.adminUserOptions.length
211
+        if (leng == 0) {
212
+          return name
213
+        }
214
+        for (let index = 0; index < leng; index++) {
215
+          if (this.adminUserOptions[index].id == id) {
216
+            name = this.adminUserOptions[index].name
217
+            break
218
+          }
219
+        }
220
+        return name
221
+      }, fetchAllAdminUsers() {
222
+        fetchAllAdminUsers().then(response => {
223
+          console.log(response)
224
+          if (response.data.state == 1) {
225
+            this.adminUserOptions = response.data.data.users
226
+            var alen = this.adminUserOptions.length
227
+            for (let index = 0; index < alen; index++) {
228
+              if (this.adminUserOptions[index].user_type == 2) {
229
+                // this.doctorOptions.push(this.adminUserOptions[index]);
230
+              }
231
+            }
232
+          }
233
+        })
234
+      }, handleSelectionChange: function(val) {
235
+        this.multipleSelection = val
236
+      }, handleSizeChange(val) {
237
+        this.limit = val
238
+        this.GetWarehouse()
239
+      }, handleCurrentChange(val) {
240
+        this.page = val
241
+        this.GetWarehouse()
242
+      }, startTimeChange(val) {
243
+        this.GetWarehouse()
244
+      }, endTimeChange(val) {
245
+        this.GetWarehouse()
246
+      }, calculate: function(val) {
247
+        return Math.round(parseFloat(val) * 100) / 100
248
+      }, GetConfigInfo: function() {
249
+        GetAllConfig().then(response => {
250
+          if (response.data.state == 0) {
251
+            this.$message.error(response.data.msg)
252
+            return false
253
+          } else {
254
+            this.manufacturer = response.data.data.manufacturer
255
+            this.dealer = response.data.data.dealer
256
+          }
257
+        })
258
+      }, getManufactuerName: function(manufacturer_id) {
259
+        for (let i = 0; i < this.manufacturer.length; i++) {
260
+          if (this.manufacturer[i].id == manufacturer_id) {
261
+            return this.manufacturer[i].manufacturer_name
262
+          }
263
+        }
264
+      }, getDealerName: function(dealer_id) {
265
+        for (let i = 0; i < this.dealer.length; i++) {
266
+          if (this.dealer[i].id == dealer_id) {
267
+            return this.dealer[i].dealer_name
268
+          }
269
+        }
270
+      }, handleEdit: function(index, row) {
271
+        this.$router.push({ name: 'cancelStockDetail', query: { id: row.id }})
272
+      }, handleDelete: function(index, row) {
273
+        const ids = []
274
+        ids.push(row.id)
275
+        const idStr = ids.join(',')
276
+
277
+        const params = {
278
+          ids: idStr
279
+        }
280
+
281
+        this.$confirm('确认删除出库退库单记录?', '删除出库退库单记录', {
282
+          confirmButtonText: '确定',
283
+          cancelButtonText: '取消',
284
+          type: 'warning'
285
+        }).then(() => {
286
+          deleteCancelStock(params).then(response => {
287
+            if (response.data.state == 0) {
288
+              this.$message.error(response.data.msg)
289
+              return false
290
+            } else {
291
+              this.$notify({
292
+                title: '成功',
293
+                message: '删除成功',
294
+                type: 'success',
295
+                duration: 2000
296
+              })
297
+              for (let i = 0; i < ids.length; i++) {
298
+                for (let y = 0; y < this.cancelStockDate.length; y++) {
299
+                  if (ids[i] == this.cancelStockDate[y].id) {
300
+                    this.cancelStockDate.splice(y, 1)
301
+                  }
302
+                }
303
+              }
304
+            }
305
+          })
306
+        }).catch(() => {
307
+        })
308
+      }, changeAllSelected: function(val) {
309
+        if (val) {
310
+          this.$refs.multipleTable.toggleAllSelection()
311
+        } else {
312
+          this.$refs.multipleTable.clearSelection()
313
+        }
314
+      }, select(selection) {
315
+        this.selectedTableData = selection
316
+      }, batchDelete() {
317
+        if (this.selectedTableData.length <= 0) {
318
+          this.$message.error('请选择要删除的记录')
319
+          return
320
+        }
321
+        const ids = []
322
+        for (let i = 0; i < this.selectedTableData.length; i++) {
323
+          ids.push(this.selectedTableData[i].id)
324
+        }
325
+        const idStr = ids.join(',')
326
+        const params = {
327
+          ids: idStr
328
+        }
329
+        this.$confirm('确认删除出库退库单记录?', '删除出库退库单记录', {
330
+          confirmButtonText: '确定',
331
+          cancelButtonText: '取消',
332
+          type: 'warning'
333
+        }).then(() => {
334
+          deleteCancelStock(params).then(response => {
335
+            if (response.data.state == 0) {
336
+              this.$message.error(response.data.msg)
337
+              return false
338
+            } else {
339
+              this.$notify({
340
+                title: '成功',
341
+                message: '删除成功',
342
+                type: 'success',
343
+                duration: 2000
344
+              })
345
+
346
+              for (let i = 0; i < ids.length; i++) {
347
+                for (let y = 0; y < this.cancelStockDate.length; y++) {
348
+                  if (ids[i] == this.cancelStockDate[y].id) {
349
+                    this.cancelStockDate.splice(y, 1)
350
+                  }
351
+                }
352
+              }
353
+            }
354
+          })
355
+        }).catch(() => {
356
+        })
357
+      }
358
+    }
359
+  }
360
+</script>
361
+
362
+<style rel="stylesheet/css" lang="scss" scoped>
363
+  .information {
364
+    border: 1px #dcdfe6 solid;
365
+    padding: 30px 20px 30px 20px;
366
+
367
+  .border {
368
+    border-bottom: 1px #dcdfe6 solid;
369
+    margin: 0px 0 20px 0;
370
+  }
371
+
372
+  }
373
+
374
+  .title {
375
+    background: #409eff;
376
+    height: 44px;
377
+    line-height: 44px;
378
+    padding: 0 0 0 10px;
379
+    color: #fff;
380
+    margin: 0 0 10px 0;
381
+
382
+  }
383
+
384
+  .edit_separater {
385
+    border-top: 1px solid rgb(233, 233, 233);
386
+    margin-top: 15px;
387
+    margin-bottom: 15px;
388
+  }
389
+
390
+</style>
391
+
392
+<style>
393
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
394
+    font-size: 12px;
395
+  }
396
+
397
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
398
+    background: #6fb5fa;
399
+  }
400
+
401
+  .count {
402
+    color: #bd2c00;
403
+
404
+  }
405
+
406
+</style>

+ 407 - 0
src/xt_pages/stock/cancelStockOrderAdd.vue Целия файл

@@ -0,0 +1,407 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <sales-return-dialog :propForm="propForm"
6
+                         :visibility="isVisibility"
7
+                         v-on:dialog-comfirm="comfirm"
8
+                         v-on:dialog-cancle="cancle"></sales-return-dialog>
9
+
10
+    <div class="filter-container">
11
+
12
+      <el-row>
13
+        <el-col :span="8"><div>
14
+          <span>退货时间:</span>
15
+          <el-date-picker v-model="return_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
16
+                          type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
17
+                          value-format="yyyy-MM-dd"></el-date-picker>
18
+        </div></el-col>
19
+
20
+
21
+        <el-col :span="8">
22
+          <div>
23
+            <el-form ref="form" :model="form" :rules="ruleForm" label-width="80px">
24
+              <el-form-item label="厂商:" prop="manufacturer">
25
+                <el-select v-model="form.manufacturer" placeholder="请选择厂商">
26
+                  <el-option v-for="(option, index) in manufacturer" :key="index" :label="option.manufacturer_name" :value="option.id"></el-option>
27
+                </el-select>
28
+              </el-form-item>
29
+            </el-form>
30
+          </div>
31
+        </el-col>
32
+        <el-col :span="8">
33
+          <div>
34
+            <el-form ref="form" :model="form" label-width="80px">
35
+              <el-form-item label="经销商:">
36
+                <el-select v-model="form.dealer" placeholder="请选择经销商">
37
+                  <el-option v-for="(option, index) in dealer" :key="index" :label="option.dealer_name" :value="option.id"></el-option>
38
+                </el-select>
39
+              </el-form-item>
40
+            </el-form>
41
+          </div>
42
+        </el-col>
43
+      </el-row>
44
+
45
+    </div>
46
+
47
+    <el-row>
48
+      <el-col>
49
+        <el-form  :rules="tableRules" :model="recordInfo" ref="tableForm">
50
+          <el-table :data="recordInfo.recordData" :class="signAndWeighBoxPatients" style="width: 100%" border
51
+                    max-height="450"
52
+          >
53
+
54
+            <el-table-column label="操作" align="center" min-width="30">
55
+              <template slot-scope="scope">
56
+                <el-button
57
+                  size="mini"
58
+                  @click="handleEdit(scope.$index, scope.row)">+
59
+                </el-button>
60
+                <el-button
61
+                  size="mini"
62
+                  type="danger"
63
+                  @click="handleDelete(scope.$index, scope.row)">-
64
+                </el-button>
65
+              </template>
66
+            </el-table-column>
67
+
68
+            <el-table-column min-width="35" align="center">
69
+
70
+              <template slot="header" slot-scope="scope">
71
+                <span>物品类型<span style="color: red">*</span></span>
72
+              </template>
73
+
74
+              <template slot-scope="scope" >
75
+                <!--<span @click="showDialog(scope.$index, scope.row)" v-if="scope.row.good_type_id == 0" style="color:#c5c8cf">请输入类型</span>-->
76
+                <!--<span @click="showDialog(scope.$index, scope.row)" v-if="scope.row.good_type_id != 0">{{typeName(scope.row.good_type_id)}}</span>-->
77
+
78
+                <el-form-item  style="padding-top: 15px">
79
+                  <el-input placeholder="请输入物品类型"  v-model="scope.row.good_type_id" :value="typeName(scope.row.good_type_id)" @focus="showDialog(scope.$index, scope.row)" ></el-input>
80
+                </el-form-item>
81
+
82
+              </template>
83
+            </el-table-column>
84
+            <el-table-column min-width="35" align="center">
85
+              <template slot="header" slot-scope="scope">
86
+                <span>规格名称<span style="color: red">*</span></span>
87
+              </template>
88
+              <template slot-scope="scope">
89
+
90
+                <el-form-item  style="padding-top: 15px">
91
+                  <el-input placeholder="请输入规格名称"  v-model="scope.row.good_id" :value="specificationName(scope.row.good_id)" @focus="showDialog(scope.$index, scope.row)" ></el-input>
92
+                </el-form-item>
93
+
94
+              </template>
95
+            </el-table-column>
96
+
97
+
98
+            <el-table-column  min-width="23" align="center">
99
+              <template slot="header" slot-scope="scope">
100
+                <span>退库数量<span style="color: red">*</span></span>
101
+              </template>
102
+              <template slot-scope="scope">
103
+                <!--{{scope.row.warehousing_count}}-->
104
+                <!--<el-input type="number" v-model="scope.row.warehousing_count"   @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
105
+
106
+                <el-form-item :prop="'recordData.' + scope.$index + '.return_count'" :rules='tableRules.return_count' style="padding-top: 17px">
107
+                  <el-input type="number"  v-model="scope.row.return_count" ></el-input>
108
+                </el-form-item>
109
+              </template>
110
+            </el-table-column>
111
+
112
+          </el-table>
113
+        </el-form>
114
+      </el-col>
115
+
116
+
117
+      <span  class="dialog-footer" style="margin-top: 20px;float:right">
118
+        <el-button @click="back()">取 消</el-button>
119
+        <el-button type="primary" @click="submit()">确 定</el-button>
120
+      </span>
121
+
122
+    </el-row>
123
+  </div>
124
+</template>
125
+
126
+<script>
127
+  import { uParseTime } from '@/utils/tools'
128
+  import {
129
+    getCancelStockConfig,
130
+    postCancelStock,
131
+  } from '@/api/stock'
132
+  import SalesReturnDialog from './Dialog/salesReturnDialog'
133
+
134
+  export default {
135
+    components: { SalesReturnDialog},
136
+    name: 'salesReturnOrderAdd',
137
+
138
+    data() {
139
+      return {
140
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
141
+        return_time: '',
142
+        currentIndex: 0,
143
+        recordInfo: {
144
+          recordData: [],
145
+        },
146
+        tableRules: {
147
+          return_count: [
148
+            { required: true, message: '数量不能为空', trigge: 'blur' }
149
+          ],
150
+        },
151
+        ruleForm: {
152
+          manufacturer: [
153
+            { required: true, message: '请选择厂商', trigger: 'change' }
154
+          ]
155
+
156
+        },
157
+        // prop
158
+        isVisibility: false,
159
+        propForm: {
160
+          goodType: [],
161
+          goodInfo: [],
162
+          goodUnit: [],
163
+        },
164
+        form: {
165
+          manufacturer: '',
166
+          dealer: ''
167
+        },
168
+
169
+        manufacturer: [],
170
+        dealer: [],
171
+        goodType: []
172
+      }
173
+    },
174
+    methods: {
175
+      comfirm: function(val) {
176
+        this.isVisibility = false
177
+        if (val.selectedGoodInfo.length > 0) {
178
+          for (let i = val.selectedGoodInfo.length - 1; ;i--) {
179
+            if (i == 0) {
180
+              this.recordInfo.recordData[this.currentIndex].good_type_id = val.goodTypeId
181
+              this.recordInfo.recordData[this.currentIndex].good_id = val.selectedGoodInfo[i].id
182
+            } else {
183
+              const tempForm = {}
184
+              tempForm['good_type_id'] = val.goodTypeId
185
+              tempForm['good_id'] = val.selectedGoodInfo[i].id
186
+              tempForm['return_count'] = ''
187
+              this.recordInfo.recordData.push(tempForm)
188
+            }
189
+          }
190
+        }
191
+
192
+        this.currentIndex = -1
193
+      }, cancle: function() {
194
+        this.isVisibility = false
195
+      }, GetConfigInfo: function() {
196
+        getCancelStockConfig().then(response => {
197
+          if (response.data.state == 0) {
198
+            this.$message.error(response.data.msg)
199
+            return false
200
+          } else {
201
+            var warehouseOutList =  response.data.data.warehouseOutList
202
+            var warehouseOutInfoList =  response.data.data.warehouseOutInfoList
203
+            for (let i = 0; i <warehouseOutList.length; i++ ){
204
+              if(warehouseOutList[i].Manufacturer.id > 0){
205
+                this.manufacturer.push(warehouseOutList[i].Manufacturer)
206
+              }
207
+              if(warehouseOutList[i].Dealer.id > 0){
208
+                this.dealer.push(warehouseOutList[i].Dealer)
209
+              }
210
+            }
211
+
212
+            for (let i = 0; i < warehouseOutInfoList.length; i++) {
213
+              this.propForm.goodInfo.push(warehouseOutInfoList[i].GoodInfo)
214
+
215
+            }
216
+
217
+
218
+            const obj = {}
219
+            const obj2 = {}
220
+            const obj4 = {}
221
+            //去重复
222
+            this.manufacturer =  this.manufacturer.reduce((cur, next) => {
223
+              obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
224
+              return cur
225
+            }, [])
226
+            //去重复
227
+            this.dealer =  this.dealer.reduce((cur, next) => {
228
+              obj2[next.id] ? '' : obj2[next.id] = true && cur.push(next)
229
+              return cur
230
+            }, [])
231
+            this.propForm.goodInfo = this.propForm.goodInfo.reduce((cur, next) => {
232
+              obj4[next.id] ? '' : obj4[next.id] = true && cur.push(next)
233
+              return cur
234
+            }, [])
235
+
236
+
237
+          }
238
+        })
239
+      }, typeName: function(good_type_id) {
240
+        let name = ''
241
+        for (let i = 0; i < this.propForm.goodType.length; i++) {
242
+          if (this.propForm.goodType[i].id == good_type_id) {
243
+            name = this.propForm.goodType[i].type_name
244
+          }
245
+        }
246
+        return name
247
+      }, specificationName: function(good_info_id) {
248
+        let name = ''
249
+        for (let i = 0; i < this.propForm.goodInfo.length; i++) {
250
+          if (this.propForm.goodInfo[i].id == good_info_id) {
251
+            name = this.propForm.goodInfo[i].specification_name
252
+          }
253
+        }
254
+        return name
255
+      }, handleEdit: function(index, row) {
256
+        const tempObj = {}
257
+        tempObj['good_type_id'] = 0
258
+        tempObj['good_id'] = 0
259
+        tempObj['return_count'] = ''
260
+        this.recordInfo.recordData.push(tempObj)
261
+      }, handleDelete: function(index, row) {
262
+        this.recordInfo.recordData.splice(index, 1)
263
+      }, calculate: function(val) {
264
+
265
+        if (val == 0) {
266
+          return ''
267
+        }
268
+
269
+        return Math.round(parseFloat(val) * 100) / 100
270
+      }, getTime(val, temp) {
271
+        if (val != 0) {
272
+          return uParseTime(val, temp)
273
+        } else {
274
+          return ''
275
+        }
276
+      }, showDialog(index, row) {
277
+        this.currentIndex = index
278
+        if (this.form.manufacturer == '' || this.form.manufacturer == 0) {
279
+          this.$message.error('请先选择厂商')
280
+          return
281
+        } else {
282
+          this.isVisibility = true
283
+          console.log(this.form.manufacturer)
284
+          for (let i = 0; i < this.propForm.goodInfo.length; i++){
285
+            if(this.propForm.goodInfo[i].manufacturer == this.form.manufacturer){
286
+              this.propForm.goodType.push(this.propForm.goodInfo[i].GoodsType)
287
+            }
288
+
289
+          }
290
+          const obj3 = {}
291
+          this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
292
+            obj3[next.id] ? '' : obj3[next.id] = true && cur.push(next)
293
+            return cur
294
+          }, [])
295
+
296
+
297
+
298
+        }
299
+      }, back() {
300
+        this.$router.go(-1)
301
+      }, submit() {
302
+        this.$refs['tableForm'].validate((valid) => {
303
+          if (valid) {
304
+            if (this.form.manufacturer == 0) {
305
+              this.$message.error('厂商不能为空')
306
+              return
307
+            }
308
+            const array = this.recordInfo.recordData
309
+            let total = 0
310
+            for (let i = 0; i < array.length; i++) {
311
+              if (array[i].good_type_id == 0) {
312
+                this.$message.error('物品类型不能为空')
313
+                return
314
+              }
315
+              if (array[i].good_id == 0) {
316
+                this.$message.error('规格名称不能为空')
317
+                return
318
+              }
319
+              total = total + array[i].price * array[i].return_count
320
+            }
321
+            const params = {
322
+              'cancelStock': this.recordInfo.recordData
323
+            }
324
+            postCancelStock(params,this.return_time,this.form.manufacturer,this.form.dealer).then(response=>{
325
+              if (response.data.state==0) {
326
+                this.$message.error(response.data.msg);
327
+                return false;
328
+              }else {
329
+                this.$notify({
330
+                  title: "成功",
331
+                  message: "退货成功",
332
+                  type: "success",
333
+                  duration: 2000
334
+                });
335
+                this.recordInfo.recordData = []
336
+                this.$router.back(-1)
337
+              }
338
+            });
339
+          } else {
340
+            return false
341
+          }
342
+        })
343
+      }
344
+    },
345
+    created() {
346
+      var year = new Date().getFullYear()
347
+      var month = new Date().getMonth() + 1
348
+      var day = new Date().getDate()
349
+      if (parseInt(month) < 10) {
350
+        month = '0' + month
351
+      }
352
+      if (parseInt(day) < 10) {
353
+        day = '0' + day
354
+      }
355
+      const endTime = year + '-' + month + '-' + day
356
+      this.return_time = endTime
357
+      const tempObj = {}
358
+      tempObj['good_type_id'] = 0
359
+      tempObj['good_id'] = 0
360
+      tempObj['return_count'] = ''
361
+      this.recordInfo.recordData.push(tempObj)
362
+      this.GetConfigInfo()
363
+      this.propForm.goodUnit = this.$store.getters.good_unit
364
+    }
365
+
366
+  }
367
+</script>
368
+
369
+<style rel="stylesheet/css" lang="scss" scoped>
370
+  .information {
371
+    border: 1px #dcdfe6 solid;
372
+    padding: 30px 20px 30px 20px;
373
+
374
+  .border {
375
+    border-bottom: 1px #dcdfe6 solid;
376
+    margin: 0px 0 20px 0;
377
+  }
378
+  }
379
+
380
+  .title {
381
+    background: #409eff;
382
+    height: 44px;
383
+    line-height: 44px;
384
+    padding: 0 0 0 10px;
385
+    color: #fff;
386
+    margin: 0 0 10px 0;
387
+  // border-radius: 4px 4px 0 0;
388
+  }
389
+
390
+  .edit_separater {
391
+    border-top: 1px solid rgb(233, 233, 233);
392
+    margin-top: 15px;
393
+    margin-bottom: 15px;
394
+  }
395
+
396
+</style>
397
+
398
+<style>
399
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
400
+    font-size: 12px;
401
+  }
402
+
403
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
404
+    background: #6fb5fa;
405
+  }
406
+
407
+</style>

+ 232 - 0
src/xt_pages/stock/cancelStockOrderDetail.vue Целия файл

@@ -0,0 +1,232 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <div class="filter-container">
6
+      <span style="font-size: 20px">退货单详情</span>
7
+      <el-row style="float:right;">
8
+        <span>{{CancelStockInfo.cancelStock.order_number}}</span>
9
+      </el-row>
10
+    </div>
11
+
12
+
13
+
14
+    <div class="filter-container">
15
+      <span>单据日期:  {{CancelStockInfo.cancelStock.return_time | parseTime('{y}-{m}-{d}')}} </span>
16
+      <span>厂商 {{getManufactuerName(CancelStockInfo.cancelStock.manufacturer)}}</span>
17
+      <span>经销商 {{getDealerName(CancelStockInfo.cancelStock.dealer)}}</span>
18
+    </div>
19
+
20
+    <div class="filter-container" style="margin-top: 10px">
21
+      <el-button size="small" icon="el-icon-edit" @click="editRecord">编辑</el-button>
22
+      <el-button size="small" icon="el-icon-delete" @click="deleteRecord">删除</el-button>
23
+    </div>
24
+
25
+    <el-row :gutter="12" style="margin-top: 10px">
26
+      <el-table :data="CancelStockInfo.cancelStockInfoData" :class="signAndWeighBoxPatients" style="width: 100%" border
27
+      >
28
+        <el-table-column min-width="35" align="center">
29
+          <template slot="header" slot-scope="scope">
30
+            <span>物品类型</span>
31
+          </template>
32
+
33
+          <template slot-scope="scope">
34
+            <span v-if="scope.row.good_type_id != 0">{{getTypeName(scope.row.good_type_id)}}</span>
35
+          </template>
36
+        </el-table-column>
37
+        <el-table-column min-width="35" align="center">
38
+          <template slot="header" slot-scope="scope">
39
+            <span>规格名称</span>
40
+          </template>
41
+          <template slot-scope="scope">
42
+            <span v-if="scope.row.good_id != 0">{{getSpecificationName(scope.row.good_id)}}</span>
43
+          </template>
44
+        </el-table-column>
45
+
46
+        <el-table-column min-width="23" align="center">
47
+          <template slot="header" slot-scope="scope">
48
+            <span>退货数量</span>
49
+          </template>
50
+          <template slot-scope="scope">
51
+            <span>{{scope.row.count}}</span>
52
+
53
+          </template>
54
+        </el-table-column>
55
+
56
+
57
+      </el-table>
58
+    </el-row>
59
+  </div>
60
+</template>
61
+
62
+<script>
63
+  import { uParseTime } from '@/utils/tools'
64
+  import { GetAllConfig,getCancelStockInfo,deleteCancelStock } from '@/api/stock'
65
+
66
+  export default {
67
+    name: 'cancelStockOrderDetail',
68
+    created() {
69
+      const order_id = this.$route.query.id
70
+      this.GetConfigInfo()
71
+      this.GetOrderDetail(order_id)
72
+    },
73
+    data() {
74
+      return {
75
+        isEdit: 0,
76
+        checked: false,
77
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
78
+        goodType: [],
79
+        goodInfo: [],
80
+        manufacturer: [],
81
+        dealer: [],
82
+
83
+        CancelStockInfo: {
84
+          loading: false,
85
+          cancelStockInfoData: [],
86
+          cancelStock: {}
87
+        }
88
+      }
89
+    },
90
+    methods: {
91
+      getSpecificationName: function(id) {
92
+        let name = ''
93
+        for (let i = 0; i < this.goodInfo.length; i++) {
94
+          if (this.goodInfo[i].id == id) {
95
+            name = this.goodInfo[i].specification_name
96
+          }
97
+        }
98
+        return name
99
+      }, getTypeName: function(id) {
100
+        let name = ''
101
+        for (let i = 0; i < this.goodType.length; i++) {
102
+          if (this.goodType[i].id == id) {
103
+            name = this.goodType[i].type_name
104
+          }
105
+        }
106
+        return name
107
+      }, GetConfigInfo: function() {
108
+        GetAllConfig().then(response => {
109
+          if (response.data.state == 0) {
110
+            this.$message.error(response.data.msg)
111
+            return false
112
+          } else {
113
+            this.manufacturer = response.data.data.manufacturer
114
+            this.dealer = response.data.data.dealer
115
+            this.goodInfo = response.data.data.goodInfo
116
+            this.goodType = response.data.data.goodType
117
+          }
118
+        })
119
+      }, getManufactuerName: function(manufacturer_id) {
120
+        for (let i = 0; i < this.manufacturer.length; i++) {
121
+          if (this.manufacturer[i].id == manufacturer_id) {
122
+            return this.manufacturer[i].manufacturer_name
123
+          }
124
+        }
125
+      }, getDealerName: function(dealer_id) {
126
+        for (let i = 0; i < this.dealer.length; i++) {
127
+          if (this.dealer[i].id == dealer_id) {
128
+            return this.dealer[i].dealer_name
129
+          }
130
+        }
131
+      }, calculate: function(val) {
132
+        if (val == 0) {
133
+          return ''
134
+        }
135
+        return Math.round(parseFloat(val) * 100) / 100
136
+      }, GetOrderDetail: function(order_id) {
137
+        const params = {
138
+          'id': order_id
139
+        }
140
+        getCancelStockInfo(params).then(response => {
141
+          if (response.data.state == 0) {
142
+            this.$message.error(response.data.msg)
143
+            return false
144
+          } else {
145
+            for (let i = 0; i < response.data.data.list.length; i++) {
146
+              this.CancelStockInfo.cancelStockInfoData.push(response.data.data.list[i])
147
+            }
148
+            this.CancelStockInfo.cancelStock = response.data.data.info
149
+          }
150
+        })
151
+      }, deleteRecord: function() {
152
+        const ids = []
153
+        ids.push(this.CancelStockInfo.cancelStock.id)
154
+        const idStr = ids.join(',')
155
+
156
+        const params = {
157
+          ids: idStr
158
+        }
159
+
160
+        this.$confirm('确认删除退货单?', '删除退货单记录', {
161
+          confirmButtonText: '确定',
162
+          cancelButtonText: '取消',
163
+          type: 'warning'
164
+        }).then(() => {
165
+          deleteCancelStock(params).then(response => {
166
+            if (response.data.state == 0) {
167
+              this.$message.error(response.data.msg)
168
+              return false
169
+            } else {
170
+              this.$notify({
171
+                title: '成功',
172
+                message: '删除成功',
173
+                type: 'success',
174
+                duration: 2000
175
+              })
176
+
177
+              this.$router.back(-1)
178
+            }
179
+          })
180
+        }).catch(() => {
181
+        })
182
+      }, editRecord: function() {
183
+        this.$emit('edit-record')
184
+      }
185
+    }
186
+  }
187
+</script>
188
+
189
+<style rel="stylesheet/css" lang="scss" scoped>
190
+  .information {
191
+    border: 1px #dcdfe6 solid;
192
+    padding: 30px 20px 30px 20px;
193
+
194
+  .border {
195
+    border-bottom: 1px #dcdfe6 solid;
196
+    margin: 0px 0 20px 0;
197
+  }
198
+
199
+  }
200
+
201
+  .title {
202
+    background: #409eff;
203
+    height: 44px;
204
+    line-height: 44px;
205
+    padding: 0 0 0 10px;
206
+    color: #fff;
207
+    margin: 0 0 10px 0;
208
+  }
209
+
210
+  .edit_separater {
211
+    border-top: 1px solid rgb(233, 233, 233);
212
+    margin-top: 15px;
213
+    margin-bottom: 15px;
214
+  }
215
+
216
+</style>
217
+
218
+<style>
219
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
220
+    font-size: 12px;
221
+  }
222
+
223
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
224
+    background: #6fb5fa;
225
+  }
226
+
227
+  .count {
228
+    color: #bd2c00;
229
+
230
+  }
231
+
232
+</style>

+ 391 - 0
src/xt_pages/stock/cancelStockOrderEdit.vue Целия файл

@@ -0,0 +1,391 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <sales-return-dialog :propForm="propForm"
6
+                         :visibility="isVisibility"
7
+                         v-on:dialog-comfirm="comfirm"
8
+                         v-on:dialog-cancle="cancle"></sales-return-dialog>
9
+
10
+    <div class="filter-container">
11
+
12
+      <el-row>
13
+        <el-col :span="8">
14
+          <div>
15
+            <span>入库时间:</span>
16
+            <el-date-picker v-model="return_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
17
+                            type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
18
+                            value-format="yyyy-MM-dd"></el-date-picker>
19
+          </div>
20
+        </el-col>
21
+      </el-row>
22
+    </div>
23
+
24
+    <el-row>
25
+      <el-col>
26
+        <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
27
+          <el-table :data="recordInfo.recordData" :class="signAndWeighBoxPatients" style="width: 100%" border
28
+                    max-height="450"
29
+          >
30
+
31
+            <el-table-column label="操作" align="center" min-width="30">
32
+              <template slot-scope="scope">
33
+                <el-button
34
+                  size="mini"
35
+                  @click="handleEdit(scope.$index, scope.row)">+
36
+                </el-button>
37
+                <el-button
38
+                  size="mini"
39
+                  type="danger"
40
+                  @click="handleDelete(scope.$index, scope.row)">-
41
+                </el-button>
42
+              </template>
43
+            </el-table-column>
44
+
45
+            <el-table-column min-width="35" align="center">
46
+
47
+              <template slot="header" slot-scope="scope">
48
+                <span>物品类型<span style="color: red">*</span></span>
49
+              </template>
50
+
51
+              <template slot-scope="scope">
52
+                <el-form-item style="padding-top: 15px">
53
+                  <el-input placeholder="请输入物品类型" v-model="scope.row.good_type_id"
54
+                            :value="typeName(scope.row.good_type_id)"
55
+                            @focus="showDialog(scope.$index, scope.row)"></el-input>
56
+                </el-form-item>
57
+              </template>
58
+            </el-table-column>
59
+            <el-table-column min-width="35" align="center">
60
+              <template slot="header" slot-scope="scope">
61
+                <span>规格名称<span style="color: red">*</span></span>
62
+              </template>
63
+              <template slot-scope="scope">
64
+
65
+                <el-form-item style="padding-top: 15px">
66
+                  <el-input placeholder="请输入规格名称" v-model="scope.row.good_id"
67
+                            :value="specificationName(scope.row.good_id)"
68
+                            @focus="showDialog(scope.$index, scope.row)"></el-input>
69
+                </el-form-item>
70
+
71
+              </template>
72
+            </el-table-column>
73
+
74
+
75
+            <el-table-column min-width="23" align="center">
76
+              <template slot="header" slot-scope="scope">
77
+                <span>退货数量<span style="color: red">*</span></span>
78
+              </template>
79
+              <template slot-scope="scope">
80
+                <el-form-item :prop="'recordData.' + scope.$index + '.count'" :rules='tableRules.count'
81
+                              style="padding-top: 17px">
82
+                  <el-input type="number" v-model="scope.row.count"></el-input>
83
+                </el-form-item>
84
+              </template>
85
+            </el-table-column>
86
+
87
+
88
+          </el-table>
89
+        </el-form>
90
+      </el-col>
91
+
92
+
93
+      <span class="dialog-footer" style="margin-top: 20px;float:right">
94
+        <el-button @click="back()">取 消</el-button>
95
+        <el-button type="primary" @click="submit()">确 定</el-button>
96
+      </span>
97
+
98
+    </el-row>
99
+  </div>
100
+</template>
101
+
102
+<script>
103
+  import { uParseTime } from '@/utils/tools'
104
+
105
+  import {
106
+    deleteCancelStockInfo,
107
+    getCancelStockInfo,
108
+    getCancelStockConfig,
109
+    editCancelStockInfo
110
+  } from '@/api/stock'
111
+  import SalesReturnDialog from './Dialog/salesReturnDialog'
112
+
113
+  export default {
114
+    components: { SalesReturnDialog },
115
+    name: 'cancelStockOrderEdit',
116
+
117
+    data() {
118
+      return {
119
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
120
+        warehousing_time: '',
121
+        adminUserOptions: null,
122
+        currentIndex: 0,
123
+        return_time: '',
124
+        recordInfo: {
125
+          recordData: [],
126
+          stock_in_code: '',
127
+          current_index: ''
128
+
129
+        },
130
+        tableRules: {
131
+          count: [
132
+            { required: true, message: '数量不能为空', trigge: 'blur' }
133
+          ]
134
+
135
+        },
136
+        ruleForm: {
137
+          manufacturer: [
138
+            { required: true, message: '请选择厂商', trigger: 'change' }
139
+          ]
140
+
141
+        },
142
+
143
+        // prop
144
+        isVisibility: false,
145
+        propForm: {
146
+          goodType: [],
147
+          goodInfo: [],
148
+          goodUnit: [],
149
+          title: '入库'
150
+        },
151
+
152
+        form: {
153
+          manufacturer: '',
154
+          dealer: ''
155
+        },
156
+
157
+        cancelStock: {},
158
+        manufacturer: [],
159
+        dealer: [],
160
+        goodType: []
161
+      }
162
+    },
163
+    methods: {
164
+      comfirm: function(val) {
165
+        this.isVisibility = false
166
+        if (val.selectedGoodInfo.length > 0) {
167
+          for (let i = val.selectedGoodInfo.length - 1; ; i--) {
168
+            if (i == 0) {
169
+              this.recordInfo.recordData[this.currentIndex].good_type_id = val.goodTypeId
170
+              this.recordInfo.recordData[this.currentIndex].good_id = val.selectedGoodInfo[i].id
171
+            } else {
172
+              const tempForm = {}
173
+              tempForm['id'] = 0
174
+              tempForm['good_type_id'] = val.goodTypeId
175
+              tempForm['good_id'] = val.selectedGoodInfo[i].id
176
+              tempForm['count'] = ''
177
+              this.recordInfo.recordData.push(tempForm)
178
+            }
179
+          }
180
+        }
181
+
182
+        this.currentIndex = -1
183
+      }, cancle: function() {
184
+        this.isVisibility = false
185
+      }, GetConfigInfo: function() {
186
+        getCancelStockConfig().then(response => {
187
+          if (response.data.state == 0) {
188
+            this.$message.error(response.data.msg)
189
+            return false
190
+          } else {
191
+            var warehouseOutInfoList = response.data.data.warehouseOutInfoList
192
+            for (let i = 0; i < warehouseOutInfoList.length; i++) {
193
+              this.propForm.goodInfo.push(warehouseOutInfoList[i].GoodInfo)
194
+              this.propForm.goodType.push(warehouseOutInfoList[i].GoodInfo.GoodsType)
195
+
196
+            }
197
+            const obj3 = {}
198
+            const obj4 = {}
199
+            this.propForm.goodInfo = this.propForm.goodInfo.reduce((cur, next) => {
200
+              obj4[next.id] ? '' : obj4[next.id] = true && cur.push(next)
201
+              return cur
202
+            }, [])
203
+            this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
204
+              obj3[next.id] ? '' : obj3[next.id] = true && cur.push(next)
205
+              return cur
206
+            }, [])
207
+          }
208
+        })
209
+      }, typeName: function(good_type_id) {
210
+        let name = ''
211
+        for (let i = 0; i < this.propForm.goodType.length; i++) {
212
+          if (this.propForm.goodType[i].id == good_type_id) {
213
+            name = this.propForm.goodType[i].type_name
214
+          }
215
+        }
216
+        return name
217
+      }, specificationName: function(good_info_id) {
218
+        let name = ''
219
+        for (let i = 0; i < this.propForm.goodInfo.length; i++) {
220
+          if (this.propForm.goodInfo[i].id == good_info_id) {
221
+            name = this.propForm.goodInfo[i].specification_name
222
+          }
223
+        }
224
+        return name
225
+      }, handleEdit: function(index, row) {
226
+        const tempObj = {}
227
+        tempObj['id'] = 0
228
+        tempObj['good_type_id'] = 0
229
+        tempObj['good_id'] = 0
230
+        tempObj['count'] = ''
231
+        this.recordInfo.recordData.push(tempObj)
232
+      }, handleDelete: function(index, row) {
233
+        if (row.id == 0) {
234
+          this.recordInfo.recordData.splice(index, 1)
235
+        } else {
236
+          const params = {
237
+            id: row.id
238
+          }
239
+          this.$confirm('确认删除该退库物品信息记录?', '删除退库物品信息记录', {
240
+            confirmButtonText: '确定',
241
+            cancelButtonText: '取消',
242
+            type: 'warning'
243
+          }).then(() => {
244
+            deleteCancelStockInfo(params).then(response => {
245
+              if (response.data.state == 0) {
246
+                this.$message.error(response.data.msg)
247
+                return false
248
+              } else {
249
+                this.$notify({
250
+                  title: '成功',
251
+                  message: '删除成功',
252
+                  type: 'success',
253
+                  duration: 2000
254
+                })
255
+                this.recordInfo.recordData.splice(index, 1)
256
+              }
257
+            })
258
+          }).catch(() => {
259
+          })
260
+        }
261
+      }, getTime(val, temp) {
262
+        if (val != 0) {
263
+          return uParseTime(val, temp)
264
+        } else {
265
+          return ''
266
+        }
267
+      }, showDialog(index, row) {
268
+        this.currentIndex = index
269
+
270
+        this.isVisibility = true
271
+        console.log(this.form.manufacturer)
272
+        for (let i = 0; i < this.propForm.goodInfo.length; i++) {
273
+          if (this.propForm.goodInfo[i].manufacturer == this.form.manufacturer) {
274
+            this.propForm.goodType.push(this.propForm.goodInfo[i].GoodsType)
275
+          }
276
+        }
277
+        const obj3 = {}
278
+        this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
279
+          obj3[next.id] ? '' : obj3[next.id] = true && cur.push(next)
280
+          return cur
281
+        }, [])
282
+
283
+      }, back() {
284
+        this.$router.go(-1)
285
+      }, submit() {
286
+        this.$refs['tableForm'].validate((valid) => {
287
+          if (valid) {
288
+            const array = this.recordInfo.recordData
289
+            for (let i = 0; i < array.length; i++) {
290
+              if (array[i].good_type_id == 0) {
291
+                this.$message.error('物品类型不能为空')
292
+                return
293
+              }
294
+              if (array[i].good_id == 0) {
295
+                this.$message.error('规格名称不能为空')
296
+                return
297
+              }
298
+            }
299
+
300
+            const params = {
301
+              'cancelStock': this.recordInfo.recordData
302
+            }
303
+            editCancelStockInfo(params, this.return_time, this.$route.query.id).then(response => {
304
+              if (response.data.state == 0) {
305
+                this.$message.error(response.data.msg)
306
+                return false
307
+              } else {
308
+                this.$notify({
309
+                  title: '成功',
310
+                  message: '退库成功',
311
+                  type: 'success',
312
+                  duration: 2000
313
+                })
314
+                this.$router.back(-1)
315
+              }
316
+            })
317
+          } else {
318
+            return false
319
+          }
320
+        })
321
+      }, GetOrderDetail: function(order_id) {
322
+        const params = {
323
+          'id': order_id
324
+        }
325
+        getCancelStockInfo(params).then(response => {
326
+          if (response.data.state == 0) {
327
+            this.$message.error(response.data.msg)
328
+            return false
329
+          } else {
330
+            for (let i = 0; i < response.data.data.list.length; i++) {
331
+              response.data.data.list[i].count =  response.data.data.list[i].count.toString();
332
+              this.recordInfo.recordData.push(response.data.data.list[i])
333
+            }
334
+            this.cancelStock = response.data.data.info
335
+            this.return_time = this.getTime(this.cancelStock.return_time, '{y}-{m}-{d}')
336
+            this.form.manufacturer = this.cancelStock.manufacturer
337
+            this.form.dealer = this.cancelStock.dealer
338
+          }
339
+        })
340
+      }
341
+    },
342
+    created() {
343
+      this.GetConfigInfo()
344
+      this.propForm.goodUnit = this.$store.getters.good_unit
345
+      const order_id = this.$route.query.id
346
+      this.GetOrderDetail(order_id)
347
+    }
348
+
349
+  }
350
+</script>
351
+
352
+<style rel="stylesheet/css" lang="scss" scoped>
353
+  .information {
354
+    border: 1px #dcdfe6 solid;
355
+    padding: 30px 20px 30px 20px;
356
+
357
+  .border {
358
+    border-bottom: 1px #dcdfe6 solid;
359
+    margin: 0px 0 20px 0;
360
+  }
361
+
362
+  }
363
+
364
+  .title {
365
+    background: #409eff;
366
+    height: 44px;
367
+    line-height: 44px;
368
+    padding: 0 0 0 10px;
369
+    color: #fff;
370
+    margin: 0 0 10px 0;
371
+    border-radius: 4px 4px 0 0;
372
+  }
373
+
374
+  .edit_separater {
375
+    border-top: 1px solid rgb(233, 233, 233);
376
+    margin-top: 15px;
377
+    margin-bottom: 15px;
378
+  }
379
+
380
+</style>
381
+
382
+<style>
383
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
384
+    font-size: 12px;
385
+  }
386
+
387
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
388
+    background: #6fb5fa;
389
+  }
390
+
391
+</style>

+ 25 - 0
src/xt_pages/stock/otherCancelStockDetail.vue Целия файл

@@ -0,0 +1,25 @@
1
+<template>
2
+  <other-cancel-stock-order-detail v-if="isEdit == 0"   v-on:edit-record="isEdit = 1"></other-cancel-stock-order-detail>
3
+  <other-cancel-stock-order-edit v-else></other-cancel-stock-order-edit>
4
+</template>
5
+
6
+<script>
7
+  import CancelStockOrderDetail from './cancelStockOrderDetail'
8
+  import CancelStockOrderEdit from './cancelStockOrderEdit'
9
+  import OtherCancelStockOrderDetail from './otherCancelStockOrderDetail'
10
+  import OtherCancelStockOrderEdit from './otherCancelStockOrderEdit'
11
+  export default {
12
+    name: 'cancelStockDetail',
13
+    components: { OtherCancelStockOrderEdit, OtherCancelStockOrderDetail },
14
+    data() {
15
+      return {
16
+        isEdit: 0
17
+      }
18
+    },
19
+  }
20
+
21
+</script>
22
+
23
+<style scoped>
24
+
25
+</style>

+ 406 - 0
src/xt_pages/stock/otherCancelStockOrder.vue Целия файл

@@ -0,0 +1,406 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+
6
+    <div class="filter-container">
7
+
8
+
9
+      <el-row style="float:right;">
10
+        <el-button @click="AddNewOrder" type="primary">新增</el-button>
11
+      </el-row>
12
+    </div>
13
+
14
+    <div class="filter-container" style="margin-top:20px">
15
+      <el-input style="width: 300px;" class="filter-item" placeholder="单据日期/单据编码/制单人/供应商"/>
16
+      <el-button class="filter-item" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
17
+    </div>
18
+
19
+    <div class="filter-container">
20
+      <span>入库时间:</span>
21
+      <el-date-picker v-model="start_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
22
+                      type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
23
+                      value-format="yyyy-MM-dd" @change="startTimeChange"></el-date-picker>
24
+      <span class="">-</span>
25
+      <el-date-picker v-model="end_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
26
+                      type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
27
+                      value-format="yyyy-MM-dd" @change="endTimeChange"></el-date-picker>
28
+    </div>
29
+
30
+    <div class="filter-container" style="margin-top: 10px">
31
+      <el-checkbox style="width: 30px" v-model="checked" @change="changeAllSelected">全选</el-checkbox>
32
+      <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
33
+
34
+    </div>
35
+
36
+    <el-row :gutter="12" style="margin-top: 10px">
37
+      <el-table
38
+        :data="cancelStockDate"
39
+        :class="signAndWeighBoxPatients"
40
+        style="width: 100%" border
41
+        highlight-current-row
42
+        ref="multipleTable"
43
+        @selection-change="select"
44
+
45
+      >
46
+        <el-table-column
47
+          type="selection"
48
+          width="55">
49
+        </el-table-column>
50
+
51
+        <el-table-column label="单据日期" align="center">
52
+          <template slot-scope="scope">
53
+            {{ scope.row.return_time | parseTime('{y}-{m}-{d}')}}
54
+          </template>
55
+        </el-table-column>
56
+
57
+        <el-table-column label="单据编号" align="center">
58
+          <template slot-scope="scope">
59
+            {{scope.row.order_number}}
60
+          </template>
61
+        </el-table-column>
62
+
63
+        <el-table-column label="制单人" align="center">
64
+          <template slot-scope="scope">
65
+            {{getXuserName(scope.row.creater)}}
66
+          </template>
67
+        </el-table-column>
68
+
69
+
70
+        <el-table-column label="厂家" align="center">
71
+          <template slot-scope="scope">
72
+            {{getManufactuerName(scope.row.manufacturer)}}
73
+          </template>
74
+        </el-table-column>
75
+
76
+        <el-table-column label="经销商" align="center">
77
+          <template slot-scope="scope">
78
+            {{getDealerName(scope.row.dealer)}}
79
+          </template>
80
+        </el-table-column>
81
+
82
+        <el-table-column label="操作" align="center">
83
+          <template slot-scope="scope">
84
+            <el-button
85
+              size="mini"
86
+              type="primary"
87
+              icon="el-icon-edit"
88
+              @click="handleEdit(scope.$index, scope.row)">
89
+            </el-button>
90
+
91
+            <el-button
92
+              size="mini"
93
+              type="danger"
94
+              icon="el-icon-delete"
95
+              @click="handleDelete(scope.$index, scope.row)">
96
+            </el-button>
97
+
98
+          </template>
99
+        </el-table-column>
100
+
101
+      </el-table>
102
+
103
+      <el-pagination
104
+        @size-change="handleSizeChange"
105
+        @current-change="handleCurrentChange"
106
+        :page-sizes="[7]"
107
+        :page-size="7"
108
+        background
109
+        style="margin-top:20px;float: right"
110
+        layout="total, sizes, prev, pager, next, jumper"
111
+        :total="total">
112
+      </el-pagination>
113
+
114
+    </el-row>
115
+  </div>
116
+</template>
117
+
118
+<script>
119
+  import { uParseTime } from '@/utils/tools'
120
+  import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from '@/api/doctor'
121
+  import {
122
+    deleteCancelStock,
123
+    GetAllConfig,
124
+    getCancelStockList,
125
+  } from '@/api/stock'
126
+
127
+  export default {
128
+    name: 'salesReturnOrder',
129
+    created() {
130
+      var year = new Date().getFullYear()
131
+      var month = new Date().getMonth() + 1
132
+      var day = new Date().getDate()
133
+      if (parseInt(month) < 10) {
134
+        month = '0' + month
135
+      }
136
+      if (parseInt(day) < 10) {
137
+        day = '0' + day
138
+      }
139
+      const endTime = year + '-' + month + '-' + day
140
+      this.end_time = endTime
141
+
142
+      var year = new Date().getFullYear()
143
+      var month = new Date().getMonth()
144
+      var day = new Date().getDate()
145
+      if (parseInt(month) < 10) {
146
+        month = '0' + month
147
+      }
148
+      if (parseInt(day) < 10) {
149
+        day = '0' + day
150
+      }
151
+      const startTime = year + '-' + month + '-' + day
152
+      this.start_time = startTime
153
+      this.GetCancelStock()
154
+      this.GetConfigInfo()
155
+      this.fetchAllAdminUsers()
156
+    },
157
+    data() {
158
+      return {
159
+        page: 1,
160
+        limit: 7,
161
+        checked: false,
162
+        total: 0,
163
+        pageTotal: 0,
164
+        pageSelect: 0,
165
+        adminUserOptions: [],
166
+        multipleSelection: [],
167
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
168
+        start_time: '',
169
+        cancelStockDate: [],
170
+        end_time: '',
171
+        goodType: [],
172
+        goodInfo: [],
173
+        manufacturer: [],
174
+        selectedTableData: [],
175
+        dealer: [],
176
+
177
+      }
178
+    },
179
+    methods: {
180
+      AddNewOrder:function(){
181
+        this.$router.push({ name: 'cancelStockOrderAdd'})
182
+      },
183
+      GetCancelStock: function() {
184
+        const Params = {
185
+          page: this.page,
186
+          limit: this.limit,
187
+          start_time: this.start_time,
188
+          end_time: this.end_time
189
+        }
190
+        this.cancelStockDate = []
191
+        getCancelStockList(Params).then(response => {
192
+          if (response.data.state == 0) {
193
+            this.$message.error(response.data.msg)
194
+            return false
195
+          } else {
196
+            this.total = response.data.data.total
197
+            for (let i = 0; i < response.data.data.list.length; i++) {
198
+              this.cancelStockDate.push(response.data.data.list[i])
199
+            }
200
+          }
201
+        })
202
+      }, getXuserName(id) {
203
+        if (id <= 0) {
204
+          return ''
205
+        }
206
+        var name = ''
207
+        if (this.adminUserOptions == null || typeof (this.adminUserOptions.length) === 'undefined') {
208
+          return name
209
+        }
210
+        var leng = this.adminUserOptions.length
211
+        if (leng == 0) {
212
+          return name
213
+        }
214
+        for (let index = 0; index < leng; index++) {
215
+          if (this.adminUserOptions[index].id == id) {
216
+            name = this.adminUserOptions[index].name
217
+            break
218
+          }
219
+        }
220
+        return name
221
+      }, fetchAllAdminUsers() {
222
+        fetchAllAdminUsers().then(response => {
223
+          console.log(response)
224
+          if (response.data.state == 1) {
225
+            this.adminUserOptions = response.data.data.users
226
+            var alen = this.adminUserOptions.length
227
+            for (let index = 0; index < alen; index++) {
228
+              if (this.adminUserOptions[index].user_type == 2) {
229
+                // this.doctorOptions.push(this.adminUserOptions[index]);
230
+              }
231
+            }
232
+          }
233
+        })
234
+      }, handleSelectionChange: function(val) {
235
+        this.multipleSelection = val
236
+      }, handleSizeChange(val) {
237
+        this.limit = val
238
+        this.GetWarehouse()
239
+      }, handleCurrentChange(val) {
240
+        this.page = val
241
+        this.GetWarehouse()
242
+      }, startTimeChange(val) {
243
+        this.GetWarehouse()
244
+      }, endTimeChange(val) {
245
+        this.GetWarehouse()
246
+      }, calculate: function(val) {
247
+        return Math.round(parseFloat(val) * 100) / 100
248
+      }, GetConfigInfo: function() {
249
+        GetAllConfig().then(response => {
250
+          if (response.data.state == 0) {
251
+            this.$message.error(response.data.msg)
252
+            return false
253
+          } else {
254
+            this.manufacturer = response.data.data.manufacturer
255
+            this.dealer = response.data.data.dealer
256
+          }
257
+        })
258
+      }, getManufactuerName: function(manufacturer_id) {
259
+        for (let i = 0; i < this.manufacturer.length; i++) {
260
+          if (this.manufacturer[i].id == manufacturer_id) {
261
+            return this.manufacturer[i].manufacturer_name
262
+          }
263
+        }
264
+      }, getDealerName: function(dealer_id) {
265
+        for (let i = 0; i < this.dealer.length; i++) {
266
+          if (this.dealer[i].id == dealer_id) {
267
+            return this.dealer[i].dealer_name
268
+          }
269
+        }
270
+      }, handleEdit: function(index, row) {
271
+        this.$router.push({ name: 'cancelStockDetail', query: { id: row.id }})
272
+      }, handleDelete: function(index, row) {
273
+        const ids = []
274
+        ids.push(row.id)
275
+        const idStr = ids.join(',')
276
+
277
+        const params = {
278
+          ids: idStr
279
+        }
280
+
281
+        this.$confirm('确认删除出库退库单记录?', '删除出库退库单记录', {
282
+          confirmButtonText: '确定',
283
+          cancelButtonText: '取消',
284
+          type: 'warning'
285
+        }).then(() => {
286
+          deleteCancelStock(params).then(response => {
287
+            if (response.data.state == 0) {
288
+              this.$message.error(response.data.msg)
289
+              return false
290
+            } else {
291
+              this.$notify({
292
+                title: '成功',
293
+                message: '删除成功',
294
+                type: 'success',
295
+                duration: 2000
296
+              })
297
+              for (let i = 0; i < ids.length; i++) {
298
+                for (let y = 0; y < this.cancelStockDate.length; y++) {
299
+                  if (ids[i] == this.cancelStockDate[y].id) {
300
+                    this.cancelStockDate.splice(y, 1)
301
+                  }
302
+                }
303
+              }
304
+            }
305
+          })
306
+        }).catch(() => {
307
+        })
308
+      }, changeAllSelected: function(val) {
309
+        if (val) {
310
+          this.$refs.multipleTable.toggleAllSelection()
311
+        } else {
312
+          this.$refs.multipleTable.clearSelection()
313
+        }
314
+      }, select(selection) {
315
+        this.selectedTableData = selection
316
+      }, batchDelete() {
317
+        if (this.selectedTableData.length <= 0) {
318
+          this.$message.error('请选择要删除的记录')
319
+          return
320
+        }
321
+        const ids = []
322
+        for (let i = 0; i < this.selectedTableData.length; i++) {
323
+          ids.push(this.selectedTableData[i].id)
324
+        }
325
+        const idStr = ids.join(',')
326
+        const params = {
327
+          ids: idStr
328
+        }
329
+        this.$confirm('确认删除出库退库单记录?', '删除出库退库单记录', {
330
+          confirmButtonText: '确定',
331
+          cancelButtonText: '取消',
332
+          type: 'warning'
333
+        }).then(() => {
334
+          deleteCancelStock(params).then(response => {
335
+            if (response.data.state == 0) {
336
+              this.$message.error(response.data.msg)
337
+              return false
338
+            } else {
339
+              this.$notify({
340
+                title: '成功',
341
+                message: '删除成功',
342
+                type: 'success',
343
+                duration: 2000
344
+              })
345
+
346
+              for (let i = 0; i < ids.length; i++) {
347
+                for (let y = 0; y < this.cancelStockDate.length; y++) {
348
+                  if (ids[i] == this.cancelStockDate[y].id) {
349
+                    this.cancelStockDate.splice(y, 1)
350
+                  }
351
+                }
352
+              }
353
+            }
354
+          })
355
+        }).catch(() => {
356
+        })
357
+      }
358
+    }
359
+  }
360
+</script>
361
+
362
+<style rel="stylesheet/css" lang="scss" scoped>
363
+  .information {
364
+    border: 1px #dcdfe6 solid;
365
+    padding: 30px 20px 30px 20px;
366
+
367
+  .border {
368
+    border-bottom: 1px #dcdfe6 solid;
369
+    margin: 0px 0 20px 0;
370
+  }
371
+
372
+  }
373
+
374
+  .title {
375
+    background: #409eff;
376
+    height: 44px;
377
+    line-height: 44px;
378
+    padding: 0 0 0 10px;
379
+    color: #fff;
380
+    margin: 0 0 10px 0;
381
+
382
+  }
383
+
384
+  .edit_separater {
385
+    border-top: 1px solid rgb(233, 233, 233);
386
+    margin-top: 15px;
387
+    margin-bottom: 15px;
388
+  }
389
+
390
+</style>
391
+
392
+<style>
393
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
394
+    font-size: 12px;
395
+  }
396
+
397
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
398
+    background: #6fb5fa;
399
+  }
400
+
401
+  .count {
402
+    color: #bd2c00;
403
+
404
+  }
405
+
406
+</style>

+ 407 - 0
src/xt_pages/stock/otherCancelStockOrderAdd.vue Целия файл

@@ -0,0 +1,407 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <sales-return-dialog :propForm="propForm"
6
+                         :visibility="isVisibility"
7
+                         v-on:dialog-comfirm="comfirm"
8
+                         v-on:dialog-cancle="cancle"></sales-return-dialog>
9
+
10
+    <div class="filter-container">
11
+
12
+      <el-row>
13
+        <el-col :span="8"><div>
14
+          <span>退货时间:</span>
15
+          <el-date-picker v-model="return_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
16
+                          type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
17
+                          value-format="yyyy-MM-dd"></el-date-picker>
18
+        </div></el-col>
19
+
20
+
21
+        <el-col :span="8">
22
+          <div>
23
+            <el-form ref="form" :model="form" :rules="ruleForm" label-width="80px">
24
+              <el-form-item label="厂商:" prop="manufacturer">
25
+                <el-select v-model="form.manufacturer" placeholder="请选择厂商">
26
+                  <el-option v-for="(option, index) in manufacturer" :key="index" :label="option.manufacturer_name" :value="option.id"></el-option>
27
+                </el-select>
28
+              </el-form-item>
29
+            </el-form>
30
+          </div>
31
+        </el-col>
32
+        <el-col :span="8">
33
+          <div>
34
+            <el-form ref="form" :model="form" label-width="80px">
35
+              <el-form-item label="经销商:">
36
+                <el-select v-model="form.dealer" placeholder="请选择经销商">
37
+                  <el-option v-for="(option, index) in dealer" :key="index" :label="option.dealer_name" :value="option.id"></el-option>
38
+                </el-select>
39
+              </el-form-item>
40
+            </el-form>
41
+          </div>
42
+        </el-col>
43
+      </el-row>
44
+
45
+    </div>
46
+
47
+    <el-row>
48
+      <el-col>
49
+        <el-form  :rules="tableRules" :model="recordInfo" ref="tableForm">
50
+          <el-table :data="recordInfo.recordData" :class="signAndWeighBoxPatients" style="width: 100%" border
51
+                    max-height="450"
52
+          >
53
+
54
+            <el-table-column label="操作" align="center" min-width="30">
55
+              <template slot-scope="scope">
56
+                <el-button
57
+                  size="mini"
58
+                  @click="handleEdit(scope.$index, scope.row)">+
59
+                </el-button>
60
+                <el-button
61
+                  size="mini"
62
+                  type="danger"
63
+                  @click="handleDelete(scope.$index, scope.row)">-
64
+                </el-button>
65
+              </template>
66
+            </el-table-column>
67
+
68
+            <el-table-column min-width="35" align="center">
69
+
70
+              <template slot="header" slot-scope="scope">
71
+                <span>物品类型<span style="color: red">*</span></span>
72
+              </template>
73
+
74
+              <template slot-scope="scope" >
75
+                <!--<span @click="showDialog(scope.$index, scope.row)" v-if="scope.row.good_type_id == 0" style="color:#c5c8cf">请输入类型</span>-->
76
+                <!--<span @click="showDialog(scope.$index, scope.row)" v-if="scope.row.good_type_id != 0">{{typeName(scope.row.good_type_id)}}</span>-->
77
+
78
+                <el-form-item  style="padding-top: 15px">
79
+                  <el-input placeholder="请输入物品类型"  v-model="scope.row.good_type_id" :value="typeName(scope.row.good_type_id)" @focus="showDialog(scope.$index, scope.row)" ></el-input>
80
+                </el-form-item>
81
+
82
+              </template>
83
+            </el-table-column>
84
+            <el-table-column min-width="35" align="center">
85
+              <template slot="header" slot-scope="scope">
86
+                <span>规格名称<span style="color: red">*</span></span>
87
+              </template>
88
+              <template slot-scope="scope">
89
+
90
+                <el-form-item  style="padding-top: 15px">
91
+                  <el-input placeholder="请输入规格名称"  v-model="scope.row.good_id" :value="specificationName(scope.row.good_id)" @focus="showDialog(scope.$index, scope.row)" ></el-input>
92
+                </el-form-item>
93
+
94
+              </template>
95
+            </el-table-column>
96
+
97
+
98
+            <el-table-column  min-width="23" align="center">
99
+              <template slot="header" slot-scope="scope">
100
+                <span>退库数量<span style="color: red">*</span></span>
101
+              </template>
102
+              <template slot-scope="scope">
103
+                <!--{{scope.row.warehousing_count}}-->
104
+                <!--<el-input type="number" v-model="scope.row.warehousing_count"   @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
105
+
106
+                <el-form-item :prop="'recordData.' + scope.$index + '.return_count'" :rules='tableRules.return_count' style="padding-top: 17px">
107
+                  <el-input type="number"  v-model="scope.row.return_count" ></el-input>
108
+                </el-form-item>
109
+              </template>
110
+            </el-table-column>
111
+
112
+          </el-table>
113
+        </el-form>
114
+      </el-col>
115
+
116
+
117
+      <span  class="dialog-footer" style="margin-top: 20px;float:right">
118
+        <el-button @click="back()">取 消</el-button>
119
+        <el-button type="primary" @click="submit()">确 定</el-button>
120
+      </span>
121
+
122
+    </el-row>
123
+  </div>
124
+</template>
125
+
126
+<script>
127
+  import { uParseTime } from '@/utils/tools'
128
+  import {
129
+    getCancelStockConfig,
130
+    postCancelStock,
131
+  } from '@/api/stock'
132
+  import SalesReturnDialog from './Dialog/salesReturnDialog'
133
+
134
+  export default {
135
+    components: { SalesReturnDialog},
136
+    name: 'salesReturnOrderAdd',
137
+
138
+    data() {
139
+      return {
140
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
141
+        return_time: '',
142
+        currentIndex: 0,
143
+        recordInfo: {
144
+          recordData: [],
145
+        },
146
+        tableRules: {
147
+          return_count: [
148
+            { required: true, message: '数量不能为空', trigge: 'blur' }
149
+          ],
150
+        },
151
+        ruleForm: {
152
+          manufacturer: [
153
+            { required: true, message: '请选择厂商', trigger: 'change' }
154
+          ]
155
+
156
+        },
157
+        // prop
158
+        isVisibility: false,
159
+        propForm: {
160
+          goodType: [],
161
+          goodInfo: [],
162
+          goodUnit: [],
163
+        },
164
+        form: {
165
+          manufacturer: '',
166
+          dealer: ''
167
+        },
168
+
169
+        manufacturer: [],
170
+        dealer: [],
171
+        goodType: []
172
+      }
173
+    },
174
+    methods: {
175
+      comfirm: function(val) {
176
+        this.isVisibility = false
177
+        if (val.selectedGoodInfo.length > 0) {
178
+          for (let i = val.selectedGoodInfo.length - 1; ;i--) {
179
+            if (i == 0) {
180
+              this.recordInfo.recordData[this.currentIndex].good_type_id = val.goodTypeId
181
+              this.recordInfo.recordData[this.currentIndex].good_id = val.selectedGoodInfo[i].id
182
+            } else {
183
+              const tempForm = {}
184
+              tempForm['good_type_id'] = val.goodTypeId
185
+              tempForm['good_id'] = val.selectedGoodInfo[i].id
186
+              tempForm['return_count'] = ''
187
+              this.recordInfo.recordData.push(tempForm)
188
+            }
189
+          }
190
+        }
191
+
192
+        this.currentIndex = -1
193
+      }, cancle: function() {
194
+        this.isVisibility = false
195
+      }, GetConfigInfo: function() {
196
+        getCancelStockConfig().then(response => {
197
+          if (response.data.state == 0) {
198
+            this.$message.error(response.data.msg)
199
+            return false
200
+          } else {
201
+            var warehouseOutList =  response.data.data.warehouseOutList
202
+            var warehouseOutInfoList =  response.data.data.warehouseOutInfoList
203
+            for (let i = 0; i <warehouseOutList.length; i++ ){
204
+              if(warehouseOutList[i].Manufacturer.id > 0){
205
+                this.manufacturer.push(warehouseOutList[i].Manufacturer)
206
+              }
207
+              if(warehouseOutList[i].Dealer.id > 0){
208
+                this.dealer.push(warehouseOutList[i].Dealer)
209
+              }
210
+            }
211
+
212
+            for (let i = 0; i < warehouseOutInfoList.length; i++) {
213
+              this.propForm.goodInfo.push(warehouseOutInfoList[i].GoodInfo)
214
+
215
+            }
216
+
217
+
218
+            const obj = {}
219
+            const obj2 = {}
220
+            const obj4 = {}
221
+            //去重复
222
+            this.manufacturer =  this.manufacturer.reduce((cur, next) => {
223
+              obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
224
+              return cur
225
+            }, [])
226
+            //去重复
227
+            this.dealer =  this.dealer.reduce((cur, next) => {
228
+              obj2[next.id] ? '' : obj2[next.id] = true && cur.push(next)
229
+              return cur
230
+            }, [])
231
+            this.propForm.goodInfo = this.propForm.goodInfo.reduce((cur, next) => {
232
+              obj4[next.id] ? '' : obj4[next.id] = true && cur.push(next)
233
+              return cur
234
+            }, [])
235
+
236
+
237
+          }
238
+        })
239
+      }, typeName: function(good_type_id) {
240
+        let name = ''
241
+        for (let i = 0; i < this.propForm.goodType.length; i++) {
242
+          if (this.propForm.goodType[i].id == good_type_id) {
243
+            name = this.propForm.goodType[i].type_name
244
+          }
245
+        }
246
+        return name
247
+      }, specificationName: function(good_info_id) {
248
+        let name = ''
249
+        for (let i = 0; i < this.propForm.goodInfo.length; i++) {
250
+          if (this.propForm.goodInfo[i].id == good_info_id) {
251
+            name = this.propForm.goodInfo[i].specification_name
252
+          }
253
+        }
254
+        return name
255
+      }, handleEdit: function(index, row) {
256
+        const tempObj = {}
257
+        tempObj['good_type_id'] = 0
258
+        tempObj['good_id'] = 0
259
+        tempObj['return_count'] = ''
260
+        this.recordInfo.recordData.push(tempObj)
261
+      }, handleDelete: function(index, row) {
262
+        this.recordInfo.recordData.splice(index, 1)
263
+      }, calculate: function(val) {
264
+
265
+        if (val == 0) {
266
+          return ''
267
+        }
268
+
269
+        return Math.round(parseFloat(val) * 100) / 100
270
+      }, getTime(val, temp) {
271
+        if (val != 0) {
272
+          return uParseTime(val, temp)
273
+        } else {
274
+          return ''
275
+        }
276
+      }, showDialog(index, row) {
277
+        this.currentIndex = index
278
+        if (this.form.manufacturer == '' || this.form.manufacturer == 0) {
279
+          this.$message.error('请先选择厂商')
280
+          return
281
+        } else {
282
+          this.isVisibility = true
283
+          console.log(this.form.manufacturer)
284
+          for (let i = 0; i < this.propForm.goodInfo.length; i++){
285
+            if(this.propForm.goodInfo[i].manufacturer == this.form.manufacturer){
286
+              this.propForm.goodType.push(this.propForm.goodInfo[i].GoodsType)
287
+            }
288
+
289
+          }
290
+          const obj3 = {}
291
+          this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
292
+            obj3[next.id] ? '' : obj3[next.id] = true && cur.push(next)
293
+            return cur
294
+          }, [])
295
+
296
+
297
+
298
+        }
299
+      }, back() {
300
+        this.$router.go(-1)
301
+      }, submit() {
302
+        this.$refs['tableForm'].validate((valid) => {
303
+          if (valid) {
304
+            if (this.form.manufacturer == 0) {
305
+              this.$message.error('厂商不能为空')
306
+              return
307
+            }
308
+            const array = this.recordInfo.recordData
309
+            let total = 0
310
+            for (let i = 0; i < array.length; i++) {
311
+              if (array[i].good_type_id == 0) {
312
+                this.$message.error('物品类型不能为空')
313
+                return
314
+              }
315
+              if (array[i].good_id == 0) {
316
+                this.$message.error('规格名称不能为空')
317
+                return
318
+              }
319
+              total = total + array[i].price * array[i].return_count
320
+            }
321
+            const params = {
322
+              'cancelStock': this.recordInfo.recordData
323
+            }
324
+            postCancelStock(params,this.return_time,this.form.manufacturer,this.form.dealer).then(response=>{
325
+              if (response.data.state==0) {
326
+                this.$message.error(response.data.msg);
327
+                return false;
328
+              }else {
329
+                this.$notify({
330
+                  title: "成功",
331
+                  message: "退货成功",
332
+                  type: "success",
333
+                  duration: 2000
334
+                });
335
+                this.recordInfo.recordData = []
336
+                this.$router.back(-1)
337
+              }
338
+            });
339
+          } else {
340
+            return false
341
+          }
342
+        })
343
+      }
344
+    },
345
+    created() {
346
+      var year = new Date().getFullYear()
347
+      var month = new Date().getMonth() + 1
348
+      var day = new Date().getDate()
349
+      if (parseInt(month) < 10) {
350
+        month = '0' + month
351
+      }
352
+      if (parseInt(day) < 10) {
353
+        day = '0' + day
354
+      }
355
+      const endTime = year + '-' + month + '-' + day
356
+      this.return_time = endTime
357
+      const tempObj = {}
358
+      tempObj['good_type_id'] = 0
359
+      tempObj['good_id'] = 0
360
+      tempObj['return_count'] = ''
361
+      this.recordInfo.recordData.push(tempObj)
362
+      this.GetConfigInfo()
363
+      this.propForm.goodUnit = this.$store.getters.good_unit
364
+    }
365
+
366
+  }
367
+</script>
368
+
369
+<style rel="stylesheet/css" lang="scss" scoped>
370
+  .information {
371
+    border: 1px #dcdfe6 solid;
372
+    padding: 30px 20px 30px 20px;
373
+
374
+  .border {
375
+    border-bottom: 1px #dcdfe6 solid;
376
+    margin: 0px 0 20px 0;
377
+  }
378
+  }
379
+
380
+  .title {
381
+    background: #409eff;
382
+    height: 44px;
383
+    line-height: 44px;
384
+    padding: 0 0 0 10px;
385
+    color: #fff;
386
+    margin: 0 0 10px 0;
387
+  // border-radius: 4px 4px 0 0;
388
+  }
389
+
390
+  .edit_separater {
391
+    border-top: 1px solid rgb(233, 233, 233);
392
+    margin-top: 15px;
393
+    margin-bottom: 15px;
394
+  }
395
+
396
+</style>
397
+
398
+<style>
399
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
400
+    font-size: 12px;
401
+  }
402
+
403
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
404
+    background: #6fb5fa;
405
+  }
406
+
407
+</style>

+ 232 - 0
src/xt_pages/stock/otherCancelStockOrderDetail.vue Целия файл

@@ -0,0 +1,232 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <div class="filter-container">
6
+      <span style="font-size: 20px">退货单详情</span>
7
+      <el-row style="float:right;">
8
+        <span>{{CancelStockInfo.cancelStock.order_number}}</span>
9
+      </el-row>
10
+    </div>
11
+
12
+
13
+
14
+    <div class="filter-container">
15
+      <span>单据日期:  {{CancelStockInfo.cancelStock.return_time | parseTime('{y}-{m}-{d}')}} </span>
16
+      <span>厂商 {{getManufactuerName(CancelStockInfo.cancelStock.manufacturer)}}</span>
17
+      <span>经销商 {{getDealerName(CancelStockInfo.cancelStock.dealer)}}</span>
18
+    </div>
19
+
20
+    <div class="filter-container" style="margin-top: 10px">
21
+      <el-button size="small" icon="el-icon-edit" @click="editRecord">编辑</el-button>
22
+      <el-button size="small" icon="el-icon-delete" @click="deleteRecord">删除</el-button>
23
+    </div>
24
+
25
+    <el-row :gutter="12" style="margin-top: 10px">
26
+      <el-table :data="CancelStockInfo.cancelStockInfoData" :class="signAndWeighBoxPatients" style="width: 100%" border
27
+      >
28
+        <el-table-column min-width="35" align="center">
29
+          <template slot="header" slot-scope="scope">
30
+            <span>物品类型</span>
31
+          </template>
32
+
33
+          <template slot-scope="scope">
34
+            <span v-if="scope.row.good_type_id != 0">{{getTypeName(scope.row.good_type_id)}}</span>
35
+          </template>
36
+        </el-table-column>
37
+        <el-table-column min-width="35" align="center">
38
+          <template slot="header" slot-scope="scope">
39
+            <span>规格名称</span>
40
+          </template>
41
+          <template slot-scope="scope">
42
+            <span v-if="scope.row.good_id != 0">{{getSpecificationName(scope.row.good_id)}}</span>
43
+          </template>
44
+        </el-table-column>
45
+
46
+        <el-table-column min-width="23" align="center">
47
+          <template slot="header" slot-scope="scope">
48
+            <span>退货数量</span>
49
+          </template>
50
+          <template slot-scope="scope">
51
+            <span>{{scope.row.count}}</span>
52
+
53
+          </template>
54
+        </el-table-column>
55
+
56
+
57
+      </el-table>
58
+    </el-row>
59
+  </div>
60
+</template>
61
+
62
+<script>
63
+  import { uParseTime } from '@/utils/tools'
64
+  import { GetAllConfig,getCancelStockInfo,deleteCancelStock } from '@/api/stock'
65
+
66
+  export default {
67
+    name: 'cancelStockOrderDetail',
68
+    created() {
69
+      const order_id = this.$route.query.id
70
+      this.GetConfigInfo()
71
+      this.GetOrderDetail(order_id)
72
+    },
73
+    data() {
74
+      return {
75
+        isEdit: 0,
76
+        checked: false,
77
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
78
+        goodType: [],
79
+        goodInfo: [],
80
+        manufacturer: [],
81
+        dealer: [],
82
+
83
+        CancelStockInfo: {
84
+          loading: false,
85
+          cancelStockInfoData: [],
86
+          cancelStock: {}
87
+        }
88
+      }
89
+    },
90
+    methods: {
91
+      getSpecificationName: function(id) {
92
+        let name = ''
93
+        for (let i = 0; i < this.goodInfo.length; i++) {
94
+          if (this.goodInfo[i].id == id) {
95
+            name = this.goodInfo[i].specification_name
96
+          }
97
+        }
98
+        return name
99
+      }, getTypeName: function(id) {
100
+        let name = ''
101
+        for (let i = 0; i < this.goodType.length; i++) {
102
+          if (this.goodType[i].id == id) {
103
+            name = this.goodType[i].type_name
104
+          }
105
+        }
106
+        return name
107
+      }, GetConfigInfo: function() {
108
+        GetAllConfig().then(response => {
109
+          if (response.data.state == 0) {
110
+            this.$message.error(response.data.msg)
111
+            return false
112
+          } else {
113
+            this.manufacturer = response.data.data.manufacturer
114
+            this.dealer = response.data.data.dealer
115
+            this.goodInfo = response.data.data.goodInfo
116
+            this.goodType = response.data.data.goodType
117
+          }
118
+        })
119
+      }, getManufactuerName: function(manufacturer_id) {
120
+        for (let i = 0; i < this.manufacturer.length; i++) {
121
+          if (this.manufacturer[i].id == manufacturer_id) {
122
+            return this.manufacturer[i].manufacturer_name
123
+          }
124
+        }
125
+      }, getDealerName: function(dealer_id) {
126
+        for (let i = 0; i < this.dealer.length; i++) {
127
+          if (this.dealer[i].id == dealer_id) {
128
+            return this.dealer[i].dealer_name
129
+          }
130
+        }
131
+      }, calculate: function(val) {
132
+        if (val == 0) {
133
+          return ''
134
+        }
135
+        return Math.round(parseFloat(val) * 100) / 100
136
+      }, GetOrderDetail: function(order_id) {
137
+        const params = {
138
+          'id': order_id
139
+        }
140
+        getCancelStockInfo(params).then(response => {
141
+          if (response.data.state == 0) {
142
+            this.$message.error(response.data.msg)
143
+            return false
144
+          } else {
145
+            for (let i = 0; i < response.data.data.list.length; i++) {
146
+              this.CancelStockInfo.cancelStockInfoData.push(response.data.data.list[i])
147
+            }
148
+            this.CancelStockInfo.cancelStock = response.data.data.info
149
+          }
150
+        })
151
+      }, deleteRecord: function() {
152
+        const ids = []
153
+        ids.push(this.CancelStockInfo.cancelStock.id)
154
+        const idStr = ids.join(',')
155
+
156
+        const params = {
157
+          ids: idStr
158
+        }
159
+
160
+        this.$confirm('确认删除退货单?', '删除退货单记录', {
161
+          confirmButtonText: '确定',
162
+          cancelButtonText: '取消',
163
+          type: 'warning'
164
+        }).then(() => {
165
+          deleteCancelStock(params).then(response => {
166
+            if (response.data.state == 0) {
167
+              this.$message.error(response.data.msg)
168
+              return false
169
+            } else {
170
+              this.$notify({
171
+                title: '成功',
172
+                message: '删除成功',
173
+                type: 'success',
174
+                duration: 2000
175
+              })
176
+
177
+              this.$router.back(-1)
178
+            }
179
+          })
180
+        }).catch(() => {
181
+        })
182
+      }, editRecord: function() {
183
+        this.$emit('edit-record')
184
+      }
185
+    }
186
+  }
187
+</script>
188
+
189
+<style rel="stylesheet/css" lang="scss" scoped>
190
+  .information {
191
+    border: 1px #dcdfe6 solid;
192
+    padding: 30px 20px 30px 20px;
193
+
194
+  .border {
195
+    border-bottom: 1px #dcdfe6 solid;
196
+    margin: 0px 0 20px 0;
197
+  }
198
+
199
+  }
200
+
201
+  .title {
202
+    background: #409eff;
203
+    height: 44px;
204
+    line-height: 44px;
205
+    padding: 0 0 0 10px;
206
+    color: #fff;
207
+    margin: 0 0 10px 0;
208
+  }
209
+
210
+  .edit_separater {
211
+    border-top: 1px solid rgb(233, 233, 233);
212
+    margin-top: 15px;
213
+    margin-bottom: 15px;
214
+  }
215
+
216
+</style>
217
+
218
+<style>
219
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
220
+    font-size: 12px;
221
+  }
222
+
223
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
224
+    background: #6fb5fa;
225
+  }
226
+
227
+  .count {
228
+    color: #bd2c00;
229
+
230
+  }
231
+
232
+</style>

+ 391 - 0
src/xt_pages/stock/otherCancelStockOrderEdit.vue Целия файл

@@ -0,0 +1,391 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <sales-return-dialog :propForm="propForm"
6
+                         :visibility="isVisibility"
7
+                         v-on:dialog-comfirm="comfirm"
8
+                         v-on:dialog-cancle="cancle"></sales-return-dialog>
9
+
10
+    <div class="filter-container">
11
+
12
+      <el-row>
13
+        <el-col :span="8">
14
+          <div>
15
+            <span>入库时间:</span>
16
+            <el-date-picker v-model="return_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
17
+                            type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
18
+                            value-format="yyyy-MM-dd"></el-date-picker>
19
+          </div>
20
+        </el-col>
21
+      </el-row>
22
+    </div>
23
+
24
+    <el-row>
25
+      <el-col>
26
+        <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
27
+          <el-table :data="recordInfo.recordData" :class="signAndWeighBoxPatients" style="width: 100%" border
28
+                    max-height="450"
29
+          >
30
+
31
+            <el-table-column label="操作" align="center" min-width="30">
32
+              <template slot-scope="scope">
33
+                <el-button
34
+                  size="mini"
35
+                  @click="handleEdit(scope.$index, scope.row)">+
36
+                </el-button>
37
+                <el-button
38
+                  size="mini"
39
+                  type="danger"
40
+                  @click="handleDelete(scope.$index, scope.row)">-
41
+                </el-button>
42
+              </template>
43
+            </el-table-column>
44
+
45
+            <el-table-column min-width="35" align="center">
46
+
47
+              <template slot="header" slot-scope="scope">
48
+                <span>物品类型<span style="color: red">*</span></span>
49
+              </template>
50
+
51
+              <template slot-scope="scope">
52
+                <el-form-item style="padding-top: 15px">
53
+                  <el-input placeholder="请输入物品类型" v-model="scope.row.good_type_id"
54
+                            :value="typeName(scope.row.good_type_id)"
55
+                            @focus="showDialog(scope.$index, scope.row)"></el-input>
56
+                </el-form-item>
57
+              </template>
58
+            </el-table-column>
59
+            <el-table-column min-width="35" align="center">
60
+              <template slot="header" slot-scope="scope">
61
+                <span>规格名称<span style="color: red">*</span></span>
62
+              </template>
63
+              <template slot-scope="scope">
64
+
65
+                <el-form-item style="padding-top: 15px">
66
+                  <el-input placeholder="请输入规格名称" v-model="scope.row.good_id"
67
+                            :value="specificationName(scope.row.good_id)"
68
+                            @focus="showDialog(scope.$index, scope.row)"></el-input>
69
+                </el-form-item>
70
+
71
+              </template>
72
+            </el-table-column>
73
+
74
+
75
+            <el-table-column min-width="23" align="center">
76
+              <template slot="header" slot-scope="scope">
77
+                <span>退货数量<span style="color: red">*</span></span>
78
+              </template>
79
+              <template slot-scope="scope">
80
+                <el-form-item :prop="'recordData.' + scope.$index + '.count'" :rules='tableRules.count'
81
+                              style="padding-top: 17px">
82
+                  <el-input type="number" v-model="scope.row.count"></el-input>
83
+                </el-form-item>
84
+              </template>
85
+            </el-table-column>
86
+
87
+
88
+          </el-table>
89
+        </el-form>
90
+      </el-col>
91
+
92
+
93
+      <span class="dialog-footer" style="margin-top: 20px;float:right">
94
+        <el-button @click="back()">取 消</el-button>
95
+        <el-button type="primary" @click="submit()">确 定</el-button>
96
+      </span>
97
+
98
+    </el-row>
99
+  </div>
100
+</template>
101
+
102
+<script>
103
+  import { uParseTime } from '@/utils/tools'
104
+
105
+  import {
106
+    deleteCancelStockInfo,
107
+    getCancelStockInfo,
108
+    getCancelStockConfig,
109
+    editCancelStockInfo
110
+  } from '@/api/stock'
111
+  import SalesReturnDialog from './Dialog/salesReturnDialog'
112
+
113
+  export default {
114
+    components: { SalesReturnDialog },
115
+    name: 'cancelStockOrderEdit',
116
+
117
+    data() {
118
+      return {
119
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
120
+        warehousing_time: '',
121
+        adminUserOptions: null,
122
+        currentIndex: 0,
123
+        return_time: '',
124
+        recordInfo: {
125
+          recordData: [],
126
+          stock_in_code: '',
127
+          current_index: ''
128
+
129
+        },
130
+        tableRules: {
131
+          count: [
132
+            { required: true, message: '数量不能为空', trigge: 'blur' }
133
+          ]
134
+
135
+        },
136
+        ruleForm: {
137
+          manufacturer: [
138
+            { required: true, message: '请选择厂商', trigger: 'change' }
139
+          ]
140
+
141
+        },
142
+
143
+        // prop
144
+        isVisibility: false,
145
+        propForm: {
146
+          goodType: [],
147
+          goodInfo: [],
148
+          goodUnit: [],
149
+          title: '入库'
150
+        },
151
+
152
+        form: {
153
+          manufacturer: '',
154
+          dealer: ''
155
+        },
156
+
157
+        cancelStock: {},
158
+        manufacturer: [],
159
+        dealer: [],
160
+        goodType: []
161
+      }
162
+    },
163
+    methods: {
164
+      comfirm: function(val) {
165
+        this.isVisibility = false
166
+        if (val.selectedGoodInfo.length > 0) {
167
+          for (let i = val.selectedGoodInfo.length - 1; ; i--) {
168
+            if (i == 0) {
169
+              this.recordInfo.recordData[this.currentIndex].good_type_id = val.goodTypeId
170
+              this.recordInfo.recordData[this.currentIndex].good_id = val.selectedGoodInfo[i].id
171
+            } else {
172
+              const tempForm = {}
173
+              tempForm['id'] = 0
174
+              tempForm['good_type_id'] = val.goodTypeId
175
+              tempForm['good_id'] = val.selectedGoodInfo[i].id
176
+              tempForm['count'] = ''
177
+              this.recordInfo.recordData.push(tempForm)
178
+            }
179
+          }
180
+        }
181
+
182
+        this.currentIndex = -1
183
+      }, cancle: function() {
184
+        this.isVisibility = false
185
+      }, GetConfigInfo: function() {
186
+        getCancelStockConfig().then(response => {
187
+          if (response.data.state == 0) {
188
+            this.$message.error(response.data.msg)
189
+            return false
190
+          } else {
191
+            var warehouseOutInfoList = response.data.data.warehouseOutInfoList
192
+            for (let i = 0; i < warehouseOutInfoList.length; i++) {
193
+              this.propForm.goodInfo.push(warehouseOutInfoList[i].GoodInfo)
194
+              this.propForm.goodType.push(warehouseOutInfoList[i].GoodInfo.GoodsType)
195
+
196
+            }
197
+            const obj3 = {}
198
+            const obj4 = {}
199
+            this.propForm.goodInfo = this.propForm.goodInfo.reduce((cur, next) => {
200
+              obj4[next.id] ? '' : obj4[next.id] = true && cur.push(next)
201
+              return cur
202
+            }, [])
203
+            this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
204
+              obj3[next.id] ? '' : obj3[next.id] = true && cur.push(next)
205
+              return cur
206
+            }, [])
207
+          }
208
+        })
209
+      }, typeName: function(good_type_id) {
210
+        let name = ''
211
+        for (let i = 0; i < this.propForm.goodType.length; i++) {
212
+          if (this.propForm.goodType[i].id == good_type_id) {
213
+            name = this.propForm.goodType[i].type_name
214
+          }
215
+        }
216
+        return name
217
+      }, specificationName: function(good_info_id) {
218
+        let name = ''
219
+        for (let i = 0; i < this.propForm.goodInfo.length; i++) {
220
+          if (this.propForm.goodInfo[i].id == good_info_id) {
221
+            name = this.propForm.goodInfo[i].specification_name
222
+          }
223
+        }
224
+        return name
225
+      }, handleEdit: function(index, row) {
226
+        const tempObj = {}
227
+        tempObj['id'] = 0
228
+        tempObj['good_type_id'] = 0
229
+        tempObj['good_id'] = 0
230
+        tempObj['count'] = ''
231
+        this.recordInfo.recordData.push(tempObj)
232
+      }, handleDelete: function(index, row) {
233
+        if (row.id == 0) {
234
+          this.recordInfo.recordData.splice(index, 1)
235
+        } else {
236
+          const params = {
237
+            id: row.id
238
+          }
239
+          this.$confirm('确认删除该退库物品信息记录?', '删除退库物品信息记录', {
240
+            confirmButtonText: '确定',
241
+            cancelButtonText: '取消',
242
+            type: 'warning'
243
+          }).then(() => {
244
+            deleteCancelStockInfo(params).then(response => {
245
+              if (response.data.state == 0) {
246
+                this.$message.error(response.data.msg)
247
+                return false
248
+              } else {
249
+                this.$notify({
250
+                  title: '成功',
251
+                  message: '删除成功',
252
+                  type: 'success',
253
+                  duration: 2000
254
+                })
255
+                this.recordInfo.recordData.splice(index, 1)
256
+              }
257
+            })
258
+          }).catch(() => {
259
+          })
260
+        }
261
+      }, getTime(val, temp) {
262
+        if (val != 0) {
263
+          return uParseTime(val, temp)
264
+        } else {
265
+          return ''
266
+        }
267
+      }, showDialog(index, row) {
268
+        this.currentIndex = index
269
+
270
+        this.isVisibility = true
271
+        console.log(this.form.manufacturer)
272
+        for (let i = 0; i < this.propForm.goodInfo.length; i++) {
273
+          if (this.propForm.goodInfo[i].manufacturer == this.form.manufacturer) {
274
+            this.propForm.goodType.push(this.propForm.goodInfo[i].GoodsType)
275
+          }
276
+        }
277
+        const obj3 = {}
278
+        this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
279
+          obj3[next.id] ? '' : obj3[next.id] = true && cur.push(next)
280
+          return cur
281
+        }, [])
282
+
283
+      }, back() {
284
+        this.$router.go(-1)
285
+      }, submit() {
286
+        this.$refs['tableForm'].validate((valid) => {
287
+          if (valid) {
288
+            const array = this.recordInfo.recordData
289
+            for (let i = 0; i < array.length; i++) {
290
+              if (array[i].good_type_id == 0) {
291
+                this.$message.error('物品类型不能为空')
292
+                return
293
+              }
294
+              if (array[i].good_id == 0) {
295
+                this.$message.error('规格名称不能为空')
296
+                return
297
+              }
298
+            }
299
+
300
+            const params = {
301
+              'cancelStock': this.recordInfo.recordData
302
+            }
303
+            editCancelStockInfo(params, this.return_time, this.$route.query.id).then(response => {
304
+              if (response.data.state == 0) {
305
+                this.$message.error(response.data.msg)
306
+                return false
307
+              } else {
308
+                this.$notify({
309
+                  title: '成功',
310
+                  message: '退库成功',
311
+                  type: 'success',
312
+                  duration: 2000
313
+                })
314
+                this.$router.back(-1)
315
+              }
316
+            })
317
+          } else {
318
+            return false
319
+          }
320
+        })
321
+      }, GetOrderDetail: function(order_id) {
322
+        const params = {
323
+          'id': order_id
324
+        }
325
+        getCancelStockInfo(params).then(response => {
326
+          if (response.data.state == 0) {
327
+            this.$message.error(response.data.msg)
328
+            return false
329
+          } else {
330
+            for (let i = 0; i < response.data.data.list.length; i++) {
331
+              response.data.data.list[i].count =  response.data.data.list[i].count.toString();
332
+              this.recordInfo.recordData.push(response.data.data.list[i])
333
+            }
334
+            this.cancelStock = response.data.data.info
335
+            this.return_time = this.getTime(this.cancelStock.return_time, '{y}-{m}-{d}')
336
+            this.form.manufacturer = this.cancelStock.manufacturer
337
+            this.form.dealer = this.cancelStock.dealer
338
+          }
339
+        })
340
+      }
341
+    },
342
+    created() {
343
+      this.GetConfigInfo()
344
+      this.propForm.goodUnit = this.$store.getters.good_unit
345
+      const order_id = this.$route.query.id
346
+      this.GetOrderDetail(order_id)
347
+    }
348
+
349
+  }
350
+</script>
351
+
352
+<style rel="stylesheet/css" lang="scss" scoped>
353
+  .information {
354
+    border: 1px #dcdfe6 solid;
355
+    padding: 30px 20px 30px 20px;
356
+
357
+  .border {
358
+    border-bottom: 1px #dcdfe6 solid;
359
+    margin: 0px 0 20px 0;
360
+  }
361
+
362
+  }
363
+
364
+  .title {
365
+    background: #409eff;
366
+    height: 44px;
367
+    line-height: 44px;
368
+    padding: 0 0 0 10px;
369
+    color: #fff;
370
+    margin: 0 0 10px 0;
371
+    border-radius: 4px 4px 0 0;
372
+  }
373
+
374
+  .edit_separater {
375
+    border-top: 1px solid rgb(233, 233, 233);
376
+    margin-top: 15px;
377
+    margin-bottom: 15px;
378
+  }
379
+
380
+</style>
381
+
382
+<style>
383
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
384
+    font-size: 12px;
385
+  }
386
+
387
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
388
+    background: #6fb5fa;
389
+  }
390
+
391
+</style>

+ 24 - 0
src/xt_pages/stock/otherSalesReturnDetail.vue Целия файл

@@ -0,0 +1,24 @@
1
+<template>
2
+  <other-sales-return-order-detaill v-if="isEdit == 0"   v-on:edit-record="isEdit = 1"></other-sales-return-order-detaill>
3
+  <other-sales-reuturn-order-edit v-else></other-sales-reuturn-order-edit>
4
+</template>
5
+
6
+<script>
7
+  import OtherSalesReturnOrderDetail from './otherSalesReturnOrderDetail'
8
+  import OtherSalesReturnOrderEdit from './otherSalesReturnOrderEdit'
9
+  export default {
10
+    name: 'otherSalesReturnDetail',
11
+    components: { OtherSalesReturnOrderEdit, OtherSalesReturnOrderDetail},
12
+    data() {
13
+      return {
14
+        isEdit: 0
15
+      }
16
+    }
17
+
18
+  }
19
+
20
+</script>
21
+
22
+<style scoped>
23
+
24
+</style>

+ 408 - 0
src/xt_pages/stock/otherSalesReturnOrder.vue Целия файл

@@ -0,0 +1,408 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+
6
+    <div class="filter-container">
7
+
8
+
9
+      <el-row style="float:right;">
10
+        <el-button @click="AddNewOrder" type="primary">新增</el-button>
11
+      </el-row>
12
+    </div>
13
+
14
+    <div class="filter-container" style="margin-top:20px">
15
+      <el-input style="width: 300px;" class="filter-item" placeholder="单据日期/单据编码/制单人/供应商"/>
16
+      <el-button class="filter-item" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
17
+    </div>
18
+
19
+    <div class="filter-container">
20
+      <span>入库时间:</span>
21
+      <el-date-picker v-model="start_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
22
+                      type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
23
+                      value-format="yyyy-MM-dd" @change="startTimeChange"></el-date-picker>
24
+      <span class="">-</span>
25
+      <el-date-picker v-model="end_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
26
+                      type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
27
+                      value-format="yyyy-MM-dd" @change="endTimeChange"></el-date-picker>
28
+    </div>
29
+
30
+    <div class="filter-container" style="margin-top: 10px">
31
+      <el-checkbox style="width: 30px" v-model="checked" @change="changeAllSelected">全选</el-checkbox>
32
+      <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
33
+
34
+    </div>
35
+
36
+    <el-row :gutter="12" style="margin-top: 10px">
37
+      <el-table
38
+        :data="saleReturnDate"
39
+        :class="signAndWeighBoxPatients"
40
+        style="width: 100%" border
41
+        highlight-current-row
42
+        ref="multipleTable"
43
+        @selection-change="select"
44
+
45
+      >
46
+        <el-table-column
47
+          type="selection"
48
+          width="55">
49
+        </el-table-column>
50
+
51
+        <el-table-column label="单据日期" align="center">
52
+          <template slot-scope="scope">
53
+            {{ scope.row.opera_time | parseTime('{y}-{m}-{d}')}}
54
+          </template>
55
+        </el-table-column>
56
+
57
+        <el-table-column label="单据编号" align="center">
58
+          <template slot-scope="scope">
59
+            {{scope.row.order_number}}
60
+          </template>
61
+        </el-table-column>
62
+
63
+        <el-table-column label="制单人" align="center">
64
+          <template slot-scope="scope">
65
+            {{getXuserName(scope.row.creater)}}
66
+          </template>
67
+        </el-table-column>
68
+
69
+
70
+        <el-table-column label="厂家" align="center">
71
+          <template slot-scope="scope">
72
+            {{getManufactuerName(scope.row.manufacturer)}}
73
+          </template>
74
+        </el-table-column>
75
+
76
+        <el-table-column label="经销商" align="center">
77
+          <template slot-scope="scope">
78
+            {{getDealerName(scope.row.dealer)}}
79
+          </template>
80
+        </el-table-column>
81
+
82
+        <el-table-column label="操作" align="center">
83
+          <template slot-scope="scope">
84
+            <el-button
85
+              size="mini"
86
+              type="primary"
87
+              icon="el-icon-edit"
88
+              @click="handleEdit(scope.$index, scope.row)">
89
+            </el-button>
90
+
91
+            <el-button
92
+              size="mini"
93
+              type="danger"
94
+              icon="el-icon-delete"
95
+              @click="handleDelete(scope.$index, scope.row)">
96
+            </el-button>
97
+
98
+          </template>
99
+        </el-table-column>
100
+
101
+      </el-table>
102
+
103
+      <el-pagination
104
+        @size-change="handleSizeChange"
105
+        @current-change="handleCurrentChange"
106
+        :page-sizes="[7]"
107
+        :page-size="7"
108
+        background
109
+        style="margin-top:20px;float: right"
110
+        layout="total, sizes, prev, pager, next, jumper"
111
+        :total="total">
112
+      </el-pagination>
113
+
114
+    </el-row>
115
+  </div>
116
+</template>
117
+
118
+<script>
119
+  import { uParseTime } from '@/utils/tools'
120
+  import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from '@/api/doctor'
121
+  import {
122
+    deleteSalesReturn,
123
+    GetAllConfig,
124
+    getWarehouseInfoList,
125
+    getSalesReturnList,
126
+    getWarehouseList
127
+  } from '@/api/stock'
128
+
129
+  export default {
130
+    name: 'otherSalesReturnOrder',
131
+    created() {
132
+      var year = new Date().getFullYear()
133
+      var month = new Date().getMonth() + 1
134
+      var day = new Date().getDate()
135
+      if (parseInt(month) < 10) {
136
+        month = '0' + month
137
+      }
138
+      if (parseInt(day) < 10) {
139
+        day = '0' + day
140
+      }
141
+      const endTime = year + '-' + month + '-' + day
142
+      this.end_time = endTime
143
+
144
+      var year = new Date().getFullYear()
145
+      var month = new Date().getMonth()
146
+      var day = new Date().getDate()
147
+      if (parseInt(month) < 10) {
148
+        month = '0' + month
149
+      }
150
+      if (parseInt(day) < 10) {
151
+        day = '0' + day
152
+      }
153
+      const startTime = year + '-' + month + '-' + day
154
+      this.start_time = startTime
155
+      this.GetSalesReturn()
156
+      this.GetConfigInfo()
157
+      this.fetchAllAdminUsers()
158
+    },
159
+    data() {
160
+      return {
161
+        page: 1,
162
+        limit: 7,
163
+        checked: false,
164
+        total: 0,
165
+        pageTotal: 0,
166
+        pageSelect: 0,
167
+        adminUserOptions: [],
168
+        multipleSelection: [],
169
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
170
+        start_time: '',
171
+        saleReturnDate: [],
172
+        end_time: '',
173
+        goodType: [],
174
+        goodInfo: [],
175
+        manufacturer: [],
176
+        selectedTableData: [],
177
+        dealer: [],
178
+
179
+      }
180
+    },
181
+    methods: {
182
+      AddNewOrder:function(){
183
+        this.$router.push({ name: 'salesReturnOrderAdd'})
184
+      },
185
+      GetSalesReturn: function() {
186
+        const Params = {
187
+          page: this.page,
188
+          limit: this.limit,
189
+          start_time: this.start_time,
190
+          end_time: this.end_time
191
+        }
192
+        this.saleReturnDate = []
193
+        getSalesReturnList(Params).then(response => {
194
+          if (response.data.state == 0) {
195
+            this.$message.error(response.data.msg)
196
+            return false
197
+          } else {
198
+            this.total = response.data.data.total
199
+            for (let i = 0; i < response.data.data.list.length; i++) {
200
+              this.saleReturnDate.push(response.data.data.list[i])
201
+            }
202
+          }
203
+        })
204
+      }, getXuserName(id) {
205
+        if (id <= 0) {
206
+          return ''
207
+        }
208
+        var name = ''
209
+        if (this.adminUserOptions == null || typeof (this.adminUserOptions.length) === 'undefined') {
210
+          return name
211
+        }
212
+        var leng = this.adminUserOptions.length
213
+        if (leng == 0) {
214
+          return name
215
+        }
216
+        for (let index = 0; index < leng; index++) {
217
+          if (this.adminUserOptions[index].id == id) {
218
+            name = this.adminUserOptions[index].name
219
+            break
220
+          }
221
+        }
222
+        return name
223
+      }, fetchAllAdminUsers() {
224
+        fetchAllAdminUsers().then(response => {
225
+          console.log(response)
226
+          if (response.data.state == 1) {
227
+            this.adminUserOptions = response.data.data.users
228
+            var alen = this.adminUserOptions.length
229
+            for (let index = 0; index < alen; index++) {
230
+              if (this.adminUserOptions[index].user_type == 2) {
231
+                // this.doctorOptions.push(this.adminUserOptions[index]);
232
+              }
233
+            }
234
+          }
235
+        })
236
+      }, handleSelectionChange: function(val) {
237
+        this.multipleSelection = val
238
+      }, handleSizeChange(val) {
239
+        this.limit = val
240
+        this.GetWarehouse()
241
+      }, handleCurrentChange(val) {
242
+        this.page = val
243
+        this.GetWarehouse()
244
+      }, startTimeChange(val) {
245
+        this.GetWarehouse()
246
+      }, endTimeChange(val) {
247
+        this.GetWarehouse()
248
+      }, calculate: function(val) {
249
+        return Math.round(parseFloat(val) * 100) / 100
250
+      }, GetConfigInfo: function() {
251
+        GetAllConfig().then(response => {
252
+          if (response.data.state == 0) {
253
+            this.$message.error(response.data.msg)
254
+            return false
255
+          } else {
256
+            this.manufacturer = response.data.data.manufacturer
257
+            this.dealer = response.data.data.dealer
258
+          }
259
+        })
260
+      }, getManufactuerName: function(manufacturer_id) {
261
+        for (let i = 0; i < this.manufacturer.length; i++) {
262
+          if (this.manufacturer[i].id == manufacturer_id) {
263
+            return this.manufacturer[i].manufacturer_name
264
+          }
265
+        }
266
+      }, getDealerName: function(dealer_id) {
267
+        for (let i = 0; i < this.dealer.length; i++) {
268
+          if (this.dealer[i].id == dealer_id) {
269
+            return this.dealer[i].dealer_name
270
+          }
271
+        }
272
+      }, handleEdit: function(index, row) {
273
+        this.$router.push({ name: 'salesReturnDetail', query: { id: row.id }})
274
+      }, handleDelete: function(index, row) {
275
+        const ids = []
276
+        ids.push(row.id)
277
+        const idStr = ids.join(',')
278
+
279
+        const params = {
280
+          ids: idStr
281
+        }
282
+
283
+        this.$confirm('确认删除退货单记录?', '删除退货单记录', {
284
+          confirmButtonText: '确定',
285
+          cancelButtonText: '取消',
286
+          type: 'warning'
287
+        }).then(() => {
288
+          deleteSalesReturn(params).then(response => {
289
+            if (response.data.state == 0) {
290
+              this.$message.error(response.data.msg)
291
+              return false
292
+            } else {
293
+              this.$notify({
294
+                title: '成功',
295
+                message: '删除成功',
296
+                type: 'success',
297
+                duration: 2000
298
+              })
299
+              for (let i = 0; i < ids.length; i++) {
300
+                for (let y = 0; y < this.saleReturnDate.length; y++) {
301
+                  if (ids[i] == this.saleReturnDate[y].id) {
302
+                    this.saleReturnDate.splice(y, 1)
303
+                  }
304
+                }
305
+              }
306
+            }
307
+          })
308
+        }).catch(() => {
309
+        })
310
+      }, changeAllSelected: function(val) {
311
+        if (val) {
312
+          this.$refs.multipleTable.toggleAllSelection()
313
+        } else {
314
+          this.$refs.multipleTable.clearSelection()
315
+        }
316
+      }, select(selection) {
317
+        this.selectedTableData = selection
318
+      }, batchDelete() {
319
+        if (this.selectedTableData.length <= 0) {
320
+          this.$message.error('请选择要删除的记录')
321
+          return
322
+        }
323
+        const ids = []
324
+        for (let i = 0; i < this.selectedTableData.length; i++) {
325
+          ids.push(this.selectedTableData[i].id)
326
+        }
327
+        const idStr = ids.join(',')
328
+        const params = {
329
+          ids: idStr
330
+        }
331
+        this.$confirm('确认删除退货单记录?', '删除退货单记录', {
332
+          confirmButtonText: '确定',
333
+          cancelButtonText: '取消',
334
+          type: 'warning'
335
+        }).then(() => {
336
+          deleteSalesReturn(params).then(response => {
337
+            if (response.data.state == 0) {
338
+              this.$message.error(response.data.msg)
339
+              return false
340
+            } else {
341
+              this.$notify({
342
+                title: '成功',
343
+                message: '删除成功',
344
+                type: 'success',
345
+                duration: 2000
346
+              })
347
+
348
+              for (let i = 0; i < ids.length; i++) {
349
+                for (let y = 0; y < this.saleReturnDate.length; y++) {
350
+                  if (ids[i] == this.saleReturnDate[y].id) {
351
+                    this.saleReturnDate.splice(y, 1)
352
+                  }
353
+                }
354
+              }
355
+            }
356
+          })
357
+        }).catch(() => {
358
+        })
359
+      }
360
+    }
361
+  }
362
+</script>
363
+
364
+<style rel="stylesheet/css" lang="scss" scoped>
365
+  .information {
366
+    border: 1px #dcdfe6 solid;
367
+    padding: 30px 20px 30px 20px;
368
+
369
+  .border {
370
+    border-bottom: 1px #dcdfe6 solid;
371
+    margin: 0px 0 20px 0;
372
+  }
373
+
374
+  }
375
+
376
+  .title {
377
+    background: #409eff;
378
+    height: 44px;
379
+    line-height: 44px;
380
+    padding: 0 0 0 10px;
381
+    color: #fff;
382
+    margin: 0 0 10px 0;
383
+
384
+  }
385
+
386
+  .edit_separater {
387
+    border-top: 1px solid rgb(233, 233, 233);
388
+    margin-top: 15px;
389
+    margin-bottom: 15px;
390
+  }
391
+
392
+</style>
393
+
394
+<style>
395
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
396
+    font-size: 12px;
397
+  }
398
+
399
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
400
+    background: #6fb5fa;
401
+  }
402
+
403
+  .count {
404
+    color: #bd2c00;
405
+
406
+  }
407
+
408
+</style>

+ 413 - 0
src/xt_pages/stock/otherSalesReturnOrderAdd.vue Целия файл

@@ -0,0 +1,413 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <sales-return-dialog :propForm="propForm"
6
+                         :visibility="isVisibility"
7
+                         v-on:dialog-comfirm="comfirm"
8
+                         v-on:dialog-cancle="cancle"></sales-return-dialog>
9
+
10
+    <div class="filter-container">
11
+
12
+      <el-row>
13
+        <el-col :span="8"><div>
14
+          <span>退货时间:</span>
15
+          <el-date-picker v-model="return_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
16
+                          type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
17
+                          value-format="yyyy-MM-dd"></el-date-picker>
18
+        </div></el-col>
19
+
20
+
21
+        <el-col :span="8">
22
+          <div>
23
+            <el-form ref="form" :model="form" :rules="ruleForm" label-width="80px">
24
+              <el-form-item label="厂商:" prop="manufacturer">
25
+                <el-select v-model="form.manufacturer" placeholder="请选择厂商">
26
+                  <el-option v-for="(option, index) in manufacturer" :key="index" :label="option.manufacturer_name" :value="option.id"></el-option>
27
+                </el-select>
28
+              </el-form-item>
29
+            </el-form>
30
+          </div>
31
+        </el-col>
32
+        <el-col :span="8">
33
+          <div>
34
+            <el-form ref="form" :model="form" label-width="80px">
35
+              <el-form-item label="经销商:">
36
+                <el-select v-model="form.dealer" placeholder="请选择经销商">
37
+                  <el-option v-for="(option, index) in dealer" :key="index" :label="option.dealer_name" :value="option.id"></el-option>
38
+                </el-select>
39
+              </el-form-item>
40
+            </el-form>
41
+          </div>
42
+        </el-col>
43
+      </el-row>
44
+
45
+    </div>
46
+
47
+    <el-row>
48
+      <el-col>
49
+        <el-form  :rules="tableRules" :model="recordInfo" ref="tableForm">
50
+          <el-table :data="recordInfo.recordData" :class="signAndWeighBoxPatients" style="width: 100%" border
51
+                    max-height="450"
52
+          >
53
+
54
+            <el-table-column label="操作" align="center" min-width="30">
55
+              <template slot-scope="scope">
56
+                <el-button
57
+                  size="mini"
58
+                  @click="handleEdit(scope.$index, scope.row)">+
59
+                </el-button>
60
+                <el-button
61
+                  size="mini"
62
+                  type="danger"
63
+                  @click="handleDelete(scope.$index, scope.row)">-
64
+                </el-button>
65
+              </template>
66
+            </el-table-column>
67
+
68
+            <el-table-column min-width="35" align="center">
69
+
70
+              <template slot="header" slot-scope="scope">
71
+                <span>物品类型<span style="color: red">*</span></span>
72
+              </template>
73
+
74
+              <template slot-scope="scope" >
75
+                <!--<span @click="showDialog(scope.$index, scope.row)" v-if="scope.row.good_type_id == 0" style="color:#c5c8cf">请输入类型</span>-->
76
+                <!--<span @click="showDialog(scope.$index, scope.row)" v-if="scope.row.good_type_id != 0">{{typeName(scope.row.good_type_id)}}</span>-->
77
+
78
+                <el-form-item  style="padding-top: 15px">
79
+                  <el-input placeholder="请输入物品类型"  v-model="scope.row.good_type_id" :value="typeName(scope.row.good_type_id)" @focus="showDialog(scope.$index, scope.row)" ></el-input>
80
+                </el-form-item>
81
+
82
+              </template>
83
+            </el-table-column>
84
+            <el-table-column min-width="35" align="center">
85
+              <template slot="header" slot-scope="scope">
86
+                <span>规格名称<span style="color: red">*</span></span>
87
+              </template>
88
+              <template slot-scope="scope">
89
+
90
+                <el-form-item  style="padding-top: 15px">
91
+                  <el-input placeholder="请输入规格名称"  v-model="scope.row.good_id" :value="specificationName(scope.row.good_id)" @focus="showDialog(scope.$index, scope.row)" ></el-input>
92
+                </el-form-item>
93
+
94
+              </template>
95
+            </el-table-column>
96
+
97
+
98
+            <el-table-column  min-width="23" align="center">
99
+              <template slot="header" slot-scope="scope">
100
+                <span>退货数量<span style="color: red">*</span></span>
101
+              </template>
102
+              <template slot-scope="scope">
103
+                <!--{{scope.row.warehousing_count}}-->
104
+                <!--<el-input type="number" v-model="scope.row.warehousing_count"   @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
105
+
106
+                <el-form-item :prop="'recordData.' + scope.$index + '.return_count'" :rules='tableRules.return_count' style="padding-top: 17px">
107
+                  <el-input type="number"  v-model="scope.row.return_count" ></el-input>
108
+                </el-form-item>
109
+              </template>
110
+            </el-table-column>
111
+
112
+          </el-table>
113
+        </el-form>
114
+      </el-col>
115
+
116
+
117
+      <span  class="dialog-footer" style="margin-top: 20px;float:right">
118
+        <el-button @click="back()">取 消</el-button>
119
+        <el-button type="primary" @click="submit()">确 定</el-button>
120
+      </span>
121
+
122
+    </el-row>
123
+  </div>
124
+</template>
125
+
126
+<script>
127
+  import { uParseTime } from '@/utils/tools'
128
+  import {
129
+    getSalesReturnConfig,
130
+    postSalesReturn,
131
+  } from '@/api/stock'
132
+  import SalesReturnDialog from './Dialog/salesReturnDialog'
133
+
134
+  export default {
135
+    components: { SalesReturnDialog},
136
+    name: 'otherSalesReturnOrderAdd',
137
+
138
+    data() {
139
+      return {
140
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
141
+        return_time: '',
142
+        currentIndex: 0,
143
+        recordInfo: {
144
+          recordData: [],
145
+        },
146
+        tableRules: {
147
+          price: [
148
+            { required: true, message: '单价不能为空', trigger: 'blur' }
149
+          ],
150
+          return_count: [
151
+            { required: true, message: '数量不能为空', trigge: 'blur' }
152
+          ],
153
+        },
154
+        ruleForm: {
155
+          manufacturer: [
156
+            { required: true, message: '请选择厂商', trigger: 'change' }
157
+          ]
158
+
159
+        },
160
+        // prop
161
+        isVisibility: false,
162
+        propForm: {
163
+          goodType: [],
164
+          goodInfo: [],
165
+          goodUnit: [],
166
+        },
167
+        form: {
168
+          manufacturer: '',
169
+          dealer: ''
170
+        },
171
+
172
+        manufacturer: [],
173
+        dealer: [],
174
+        goodType: []
175
+      }
176
+    },
177
+    methods: {
178
+      comfirm: function(val) {
179
+        this.isVisibility = false
180
+        if (val.selectedGoodInfo.length > 0) {
181
+          for (let i = val.selectedGoodInfo.length - 1; ;i--) {
182
+            if (i == 0) {
183
+              this.recordInfo.recordData[this.currentIndex].good_type_id = val.goodTypeId
184
+              this.recordInfo.recordData[this.currentIndex].good_id = val.selectedGoodInfo[i].id
185
+            } else {
186
+              const tempForm = {}
187
+              tempForm['good_type_id'] = val.goodTypeId
188
+              tempForm['good_id'] = val.selectedGoodInfo[i].id
189
+              tempForm['return_count'] = ''
190
+              tempForm['price'] = ''
191
+              this.recordInfo.recordData.push(tempForm)
192
+            }
193
+          }
194
+        }
195
+
196
+        this.currentIndex = -1
197
+      }, cancle: function() {
198
+        this.isVisibility = false
199
+      }, GetConfigInfo: function() {
200
+        getSalesReturnConfig().then(response => {
201
+          if (response.data.state == 0) {
202
+            this.$message.error(response.data.msg)
203
+            return false
204
+          } else {
205
+            var warehouseList =  response.data.data.warehouseList
206
+            var warehouseInfoList =  response.data.data.warehouseInfoList
207
+            for (let i = 0; i <warehouseList.length; i++ ){
208
+              if(warehouseList[i].Manufacturer.id > 0){
209
+                this.manufacturer.push(warehouseList[i].Manufacturer)
210
+              }
211
+              if(warehouseList[i].Dealer.id > 0){
212
+                this.dealer.push(warehouseList[i].Dealer)
213
+              }
214
+            }
215
+
216
+            for (let i = 0; i < warehouseInfoList.length; i++) {
217
+              this.propForm.goodInfo.push(warehouseInfoList[i].GoodInfo)
218
+
219
+            }
220
+
221
+
222
+            const obj = {}
223
+            const obj2 = {}
224
+            const obj4 = {}
225
+            //去重复
226
+            this.manufacturer =  this.manufacturer.reduce((cur, next) => {
227
+              obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
228
+              return cur
229
+            }, [])
230
+            //去重复
231
+            this.dealer =  this.dealer.reduce((cur, next) => {
232
+              obj2[next.id] ? '' : obj2[next.id] = true && cur.push(next)
233
+              return cur
234
+            }, [])
235
+            this.propForm.goodInfo = this.propForm.goodInfo.reduce((cur, next) => {
236
+              obj4[next.id] ? '' : obj4[next.id] = true && cur.push(next)
237
+              return cur
238
+            }, [])
239
+
240
+
241
+          }
242
+        })
243
+      }, typeName: function(good_type_id) {
244
+        let name = ''
245
+        for (let i = 0; i < this.propForm.goodType.length; i++) {
246
+          if (this.propForm.goodType[i].id == good_type_id) {
247
+            name = this.propForm.goodType[i].type_name
248
+          }
249
+        }
250
+        return name
251
+      }, specificationName: function(good_info_id) {
252
+        let name = ''
253
+        for (let i = 0; i < this.propForm.goodInfo.length; i++) {
254
+          if (this.propForm.goodInfo[i].id == good_info_id) {
255
+            name = this.propForm.goodInfo[i].specification_name
256
+          }
257
+        }
258
+        return name
259
+      }, handleEdit: function(index, row) {
260
+        const tempObj = {}
261
+        tempObj['good_type_id'] = 0
262
+        tempObj['good_id'] = 0
263
+        tempObj['return_count'] = ''
264
+        tempObj['price'] = ''
265
+        this.recordInfo.recordData.push(tempObj)
266
+      }, handleDelete: function(index, row) {
267
+        this.recordInfo.recordData.splice(index, 1)
268
+      }, calculate: function(val) {
269
+
270
+        if (val == 0) {
271
+          return ''
272
+        }
273
+
274
+        return Math.round(parseFloat(val) * 100) / 100
275
+      }, getTime(val, temp) {
276
+        if (val != 0) {
277
+          return uParseTime(val, temp)
278
+        } else {
279
+          return ''
280
+        }
281
+      }, showDialog(index, row) {
282
+        this.currentIndex = index
283
+        if (this.form.manufacturer == '' || this.form.manufacturer == 0) {
284
+          this.$message.error('请先选择厂商')
285
+          return
286
+        } else {
287
+          this.isVisibility = true
288
+          console.log(this.form.manufacturer)
289
+          for (let i = 0; i < this.propForm.goodInfo.length; i++){
290
+            if(this.propForm.goodInfo[i].manufacturer == this.form.manufacturer){
291
+              this.propForm.goodType.push(this.propForm.goodInfo[i].GoodsType)
292
+            }
293
+
294
+          }
295
+          const obj3 = {}
296
+          this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
297
+            obj3[next.id] ? '' : obj3[next.id] = true && cur.push(next)
298
+            return cur
299
+          }, [])
300
+
301
+
302
+
303
+        }
304
+      }, back() {
305
+        this.$router.go(-1)
306
+      }, submit() {
307
+        this.$refs['tableForm'].validate((valid) => {
308
+          if (valid) {
309
+            if (this.form.manufacturer == 0) {
310
+              this.$message.error('厂商不能为空')
311
+              return
312
+            }
313
+            const array = this.recordInfo.recordData
314
+            let total = 0
315
+            for (let i = 0; i < array.length; i++) {
316
+              if (array[i].good_type_id == 0) {
317
+                this.$message.error('物品类型不能为空')
318
+                return
319
+              }
320
+              if (array[i].good_id == 0) {
321
+                this.$message.error('规格名称不能为空')
322
+                return
323
+              }
324
+              total = total + array[i].price * array[i].return_count
325
+            }
326
+            const params = {
327
+              'salesReturn': this.recordInfo.recordData
328
+            }
329
+            postSalesReturn(params,this.return_time,total,this.form.dealer,this.form.manufacturer).then(response=>{
330
+              if (response.data.state==0) {
331
+                this.$message.error(response.data.msg);
332
+                return false;
333
+              }else {
334
+                this.$notify({
335
+                  title: "成功",
336
+                  message: "退货成功",
337
+                  type: "success",
338
+                  duration: 2000
339
+                });
340
+                this.recordInfo.recordData = []
341
+                this.$router.back(-1)
342
+              }
343
+            });
344
+          } else {
345
+            return false
346
+          }
347
+        })
348
+      }
349
+    },
350
+    created() {
351
+      var year = new Date().getFullYear()
352
+      var month = new Date().getMonth() + 1
353
+      var day = new Date().getDate()
354
+      if (parseInt(month) < 10) {
355
+        month = '0' + month
356
+      }
357
+      if (parseInt(day) < 10) {
358
+        day = '0' + day
359
+      }
360
+      const endTime = year + '-' + month + '-' + day
361
+      this.return_time = endTime
362
+      const tempObj = {}
363
+      tempObj['good_type_id'] = 0
364
+      tempObj['good_id'] = 0
365
+      tempObj['return_count'] = ''
366
+      tempObj['price'] = ''
367
+      this.recordInfo.recordData.push(tempObj)
368
+      this.GetConfigInfo()
369
+      this.propForm.goodUnit = this.$store.getters.good_unit
370
+    }
371
+
372
+  }
373
+</script>
374
+
375
+<style rel="stylesheet/css" lang="scss" scoped>
376
+  .information {
377
+    border: 1px #dcdfe6 solid;
378
+    padding: 30px 20px 30px 20px;
379
+
380
+  .border {
381
+    border-bottom: 1px #dcdfe6 solid;
382
+    margin: 0px 0 20px 0;
383
+  }
384
+  }
385
+
386
+  .title {
387
+    background: #409eff;
388
+    height: 44px;
389
+    line-height: 44px;
390
+    padding: 0 0 0 10px;
391
+    color: #fff;
392
+    margin: 0 0 10px 0;
393
+  // border-radius: 4px 4px 0 0;
394
+  }
395
+
396
+  .edit_separater {
397
+    border-top: 1px solid rgb(233, 233, 233);
398
+    margin-top: 15px;
399
+    margin-bottom: 15px;
400
+  }
401
+
402
+</style>
403
+
404
+<style>
405
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
406
+    font-size: 12px;
407
+  }
408
+
409
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
410
+    background: #6fb5fa;
411
+  }
412
+
413
+</style>

+ 232 - 0
src/xt_pages/stock/otherSalesReturnOrderDetail.vue Целия файл

@@ -0,0 +1,232 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <div class="filter-container">
6
+      <span style="font-size: 20px">退货单详情</span>
7
+      <el-row style="float:right;">
8
+        <span>{{ReturnInfo.salesReturn.order_number}}</span>
9
+      </el-row>
10
+    </div>
11
+
12
+
13
+
14
+    <div class="filter-container">
15
+      <span>单据日期:  {{ReturnInfo.salesReturn.return_time | parseTime('{y}-{m}-{d}')}} </span>
16
+      <span>厂商 {{getManufactuerName(ReturnInfo.salesReturn.manufacturer)}}</span>
17
+      <span>经销商 {{getDealerName(ReturnInfo.salesReturn.dealer)}}</span>
18
+    </div>
19
+
20
+    <div class="filter-container" style="margin-top: 10px">
21
+      <el-button size="small" icon="el-icon-edit" @click="editRecord">编辑</el-button>
22
+      <el-button size="small" icon="el-icon-delete" @click="deleteRecord">删除</el-button>
23
+    </div>
24
+
25
+    <el-row :gutter="12" style="margin-top: 10px">
26
+      <el-table :data="ReturnInfo.returnInfoData" :class="signAndWeighBoxPatients" style="width: 100%" border
27
+      >
28
+        <el-table-column min-width="35" align="center">
29
+          <template slot="header" slot-scope="scope">
30
+            <span>物品类型</span>
31
+          </template>
32
+
33
+          <template slot-scope="scope">
34
+            <span v-if="scope.row.good_type_id != 0">{{getTypeName(scope.row.good_type_id)}}</span>
35
+          </template>
36
+        </el-table-column>
37
+        <el-table-column min-width="35" align="center">
38
+          <template slot="header" slot-scope="scope">
39
+            <span>规格名称</span>
40
+          </template>
41
+          <template slot-scope="scope">
42
+            <span v-if="scope.row.good_id != 0">{{getSpecificationName(scope.row.good_id)}}</span>
43
+          </template>
44
+        </el-table-column>
45
+
46
+        <el-table-column min-width="23" align="center">
47
+          <template slot="header" slot-scope="scope">
48
+            <span>退货数量</span>
49
+          </template>
50
+          <template slot-scope="scope">
51
+            <span>{{scope.row.count}}</span>
52
+
53
+          </template>
54
+        </el-table-column>
55
+
56
+
57
+      </el-table>
58
+    </el-row>
59
+  </div>
60
+</template>
61
+
62
+<script>
63
+  import { uParseTime } from '@/utils/tools'
64
+  import { GetAllConfig,getReturnList,deleteSalesReturn } from '@/api/stock'
65
+
66
+  export default {
67
+    name: 'otherSalesReturnOrderDetail',
68
+    created() {
69
+      const order_id = this.$route.query.id
70
+      this.GetConfigInfo()
71
+      this.GetOrderDetail(order_id)
72
+    },
73
+    data() {
74
+      return {
75
+        isEdit: 0,
76
+        checked: false,
77
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
78
+        goodType: [],
79
+        goodInfo: [],
80
+        manufacturer: [],
81
+        dealer: [],
82
+
83
+        ReturnInfo: {
84
+          loading: false,
85
+          returnInfoData: [],
86
+          salesReturn: {}
87
+        }
88
+      }
89
+    },
90
+    methods: {
91
+      getSpecificationName: function(id) {
92
+        let name = ''
93
+        for (let i = 0; i < this.goodInfo.length; i++) {
94
+          if (this.goodInfo[i].id == id) {
95
+            name = this.goodInfo[i].specification_name
96
+          }
97
+        }
98
+        return name
99
+      }, getTypeName: function(id) {
100
+        let name = ''
101
+        for (let i = 0; i < this.goodType.length; i++) {
102
+          if (this.goodType[i].id == id) {
103
+            name = this.goodType[i].type_name
104
+          }
105
+        }
106
+        return name
107
+      }, GetConfigInfo: function() {
108
+        GetAllConfig().then(response => {
109
+          if (response.data.state == 0) {
110
+            this.$message.error(response.data.msg)
111
+            return false
112
+          } else {
113
+            this.manufacturer = response.data.data.manufacturer
114
+            this.dealer = response.data.data.dealer
115
+            this.goodInfo = response.data.data.goodInfo
116
+            this.goodType = response.data.data.goodType
117
+          }
118
+        })
119
+      }, getManufactuerName: function(manufacturer_id) {
120
+        for (let i = 0; i < this.manufacturer.length; i++) {
121
+          if (this.manufacturer[i].id == manufacturer_id) {
122
+            return this.manufacturer[i].manufacturer_name
123
+          }
124
+        }
125
+      }, getDealerName: function(dealer_id) {
126
+        for (let i = 0; i < this.dealer.length; i++) {
127
+          if (this.dealer[i].id == dealer_id) {
128
+            return this.dealer[i].dealer_name
129
+          }
130
+        }
131
+      }, calculate: function(val) {
132
+        if (val == 0) {
133
+          return ''
134
+        }
135
+        return Math.round(parseFloat(val) * 100) / 100
136
+      }, GetOrderDetail: function(order_id) {
137
+        const params = {
138
+          'id': order_id
139
+        }
140
+        getReturnList(params).then(response => {
141
+          if (response.data.state == 0) {
142
+            this.$message.error(response.data.msg)
143
+            return false
144
+          } else {
145
+            for (let i = 0; i < response.data.data.list.length; i++) {
146
+              this.ReturnInfo.returnInfoData.push(response.data.data.list[i])
147
+            }
148
+            this.ReturnInfo.salesReturn = response.data.data.salesReturn
149
+          }
150
+        })
151
+      }, deleteRecord: function() {
152
+        const ids = []
153
+        ids.push(this.ReturnInfo.salesReturn.id)
154
+        const idStr = ids.join(',')
155
+
156
+        const params = {
157
+          ids: idStr
158
+        }
159
+
160
+        this.$confirm('确认删除退货单?', '删除退货单记录', {
161
+          confirmButtonText: '确定',
162
+          cancelButtonText: '取消',
163
+          type: 'warning'
164
+        }).then(() => {
165
+          deleteSalesReturn(params).then(response => {
166
+            if (response.data.state == 0) {
167
+              this.$message.error(response.data.msg)
168
+              return false
169
+            } else {
170
+              this.$notify({
171
+                title: '成功',
172
+                message: '删除成功',
173
+                type: 'success',
174
+                duration: 2000
175
+              })
176
+
177
+              this.$router.back(-1)
178
+            }
179
+          })
180
+        }).catch(() => {
181
+        })
182
+      }, editRecord: function() {
183
+        this.$emit('edit-record')
184
+      }
185
+    }
186
+  }
187
+</script>
188
+
189
+<style rel="stylesheet/css" lang="scss" scoped>
190
+  .information {
191
+    border: 1px #dcdfe6 solid;
192
+    padding: 30px 20px 30px 20px;
193
+
194
+  .border {
195
+    border-bottom: 1px #dcdfe6 solid;
196
+    margin: 0px 0 20px 0;
197
+  }
198
+
199
+  }
200
+
201
+  .title {
202
+    background: #409eff;
203
+    height: 44px;
204
+    line-height: 44px;
205
+    padding: 0 0 0 10px;
206
+    color: #fff;
207
+    margin: 0 0 10px 0;
208
+  }
209
+
210
+  .edit_separater {
211
+    border-top: 1px solid rgb(233, 233, 233);
212
+    margin-top: 15px;
213
+    margin-bottom: 15px;
214
+  }
215
+
216
+</style>
217
+
218
+<style>
219
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
220
+    font-size: 12px;
221
+  }
222
+
223
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
224
+    background: #6fb5fa;
225
+  }
226
+
227
+  .count {
228
+    color: #bd2c00;
229
+
230
+  }
231
+
232
+</style>

+ 391 - 0
src/xt_pages/stock/otherSalesReturnOrderEdit.vue Целия файл

@@ -0,0 +1,391 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <sales-return-dialog :propForm="propForm"
6
+                         :visibility="isVisibility"
7
+                         v-on:dialog-comfirm="comfirm"
8
+                         v-on:dialog-cancle="cancle"></sales-return-dialog>
9
+
10
+    <div class="filter-container">
11
+
12
+      <el-row>
13
+        <el-col :span="8">
14
+          <div>
15
+            <span>入库时间:</span>
16
+            <el-date-picker v-model="return_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
17
+                            type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
18
+                            value-format="yyyy-MM-dd"></el-date-picker>
19
+          </div>
20
+        </el-col>
21
+      </el-row>
22
+    </div>
23
+
24
+    <el-row>
25
+      <el-col>
26
+        <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
27
+          <el-table :data="recordInfo.recordData" :class="signAndWeighBoxPatients" style="width: 100%" border
28
+                    max-height="450"
29
+          >
30
+
31
+            <el-table-column label="操作" align="center" min-width="30">
32
+              <template slot-scope="scope">
33
+                <el-button
34
+                  size="mini"
35
+                  @click="handleEdit(scope.$index, scope.row)">+
36
+                </el-button>
37
+                <el-button
38
+                  size="mini"
39
+                  type="danger"
40
+                  @click="handleDelete(scope.$index, scope.row)">-
41
+                </el-button>
42
+              </template>
43
+            </el-table-column>
44
+
45
+            <el-table-column min-width="35" align="center">
46
+
47
+              <template slot="header" slot-scope="scope">
48
+                <span>物品类型<span style="color: red">*</span></span>
49
+              </template>
50
+
51
+              <template slot-scope="scope">
52
+                <el-form-item style="padding-top: 15px">
53
+                  <el-input placeholder="请输入物品类型" v-model="scope.row.good_type_id"
54
+                            :value="typeName(scope.row.good_type_id)"
55
+                            @focus="showDialog(scope.$index, scope.row)"></el-input>
56
+                </el-form-item>
57
+              </template>
58
+            </el-table-column>
59
+            <el-table-column min-width="35" align="center">
60
+              <template slot="header" slot-scope="scope">
61
+                <span>规格名称<span style="color: red">*</span></span>
62
+              </template>
63
+              <template slot-scope="scope">
64
+
65
+                <el-form-item style="padding-top: 15px">
66
+                  <el-input placeholder="请输入规格名称" v-model="scope.row.good_id"
67
+                            :value="specificationName(scope.row.good_id)"
68
+                            @focus="showDialog(scope.$index, scope.row)"></el-input>
69
+                </el-form-item>
70
+
71
+              </template>
72
+            </el-table-column>
73
+
74
+
75
+            <el-table-column min-width="23" align="center">
76
+              <template slot="header" slot-scope="scope">
77
+                <span>退货数量<span style="color: red">*</span></span>
78
+              </template>
79
+              <template slot-scope="scope">
80
+                <el-form-item :prop="'recordData.' + scope.$index + '.count'" :rules='tableRules.count'
81
+                              style="padding-top: 17px">
82
+                  <el-input type="number" v-model="scope.row.count"></el-input>
83
+                </el-form-item>
84
+              </template>
85
+            </el-table-column>
86
+
87
+
88
+          </el-table>
89
+        </el-form>
90
+      </el-col>
91
+
92
+
93
+      <span class="dialog-footer" style="margin-top: 20px;float:right">
94
+        <el-button @click="back()">取 消</el-button>
95
+        <el-button type="primary" @click="submit()">确 定</el-button>
96
+      </span>
97
+
98
+    </el-row>
99
+  </div>
100
+</template>
101
+
102
+<script>
103
+  import { uParseTime } from '@/utils/tools'
104
+
105
+  import {
106
+    deleteSalesReturnInfo,
107
+    getReturnList,
108
+    getSalesReturnConfig,
109
+    editSalesReturnInfo
110
+  } from '@/api/stock'
111
+  import SalesReturnDialog from './Dialog/salesReturnDialog'
112
+
113
+  export default {
114
+    components: { SalesReturnDialog },
115
+    name: 'otherSalesReutrnOrderEdit',
116
+
117
+    data() {
118
+      return {
119
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
120
+        warehousing_time: '',
121
+        adminUserOptions: null,
122
+        currentIndex: 0,
123
+        return_time: '',
124
+        recordInfo: {
125
+          recordData: [],
126
+          stock_in_code: '',
127
+          current_index: ''
128
+
129
+        },
130
+        tableRules: {
131
+          count: [
132
+            { required: true, message: '数量不能为空', trigge: 'blur' }
133
+          ]
134
+
135
+        },
136
+        ruleForm: {
137
+          manufacturer: [
138
+            { required: true, message: '请选择厂商', trigger: 'change' }
139
+          ]
140
+
141
+        },
142
+
143
+        // prop
144
+        isVisibility: false,
145
+        propForm: {
146
+          goodType: [],
147
+          goodInfo: [],
148
+          goodUnit: [],
149
+          title: '入库'
150
+        },
151
+
152
+        form: {
153
+          manufacturer: '',
154
+          dealer: ''
155
+        },
156
+
157
+        salesReturn: {},
158
+        manufacturer: [],
159
+        dealer: [],
160
+        goodType: []
161
+      }
162
+    },
163
+    methods: {
164
+      comfirm: function(val) {
165
+        this.isVisibility = false
166
+        if (val.selectedGoodInfo.length > 0) {
167
+          for (let i = val.selectedGoodInfo.length - 1; ; i--) {
168
+            if (i == 0) {
169
+              this.recordInfo.recordData[this.currentIndex].good_type_id = val.goodTypeId
170
+              this.recordInfo.recordData[this.currentIndex].good_id = val.selectedGoodInfo[i].id
171
+            } else {
172
+              const tempForm = {}
173
+              tempForm['id'] = 0
174
+              tempForm['good_type_id'] = val.goodTypeId
175
+              tempForm['good_id'] = val.selectedGoodInfo[i].id
176
+              tempForm['count'] = ''
177
+              this.recordInfo.recordData.push(tempForm)
178
+            }
179
+          }
180
+        }
181
+
182
+        this.currentIndex = -1
183
+      }, cancle: function() {
184
+        this.isVisibility = false
185
+      }, GetConfigInfo: function() {
186
+        getSalesReturnConfig().then(response => {
187
+          if (response.data.state == 0) {
188
+            this.$message.error(response.data.msg)
189
+            return false
190
+          } else {
191
+            var warehouseInfoList = response.data.data.warehouseInfoList
192
+            for (let i = 0; i < warehouseInfoList.length; i++) {
193
+              this.propForm.goodInfo.push(warehouseInfoList[i].GoodInfo)
194
+              this.propForm.goodType.push(warehouseInfoList[i].GoodInfo.GoodsType)
195
+
196
+            }
197
+            const obj3 = {}
198
+            const obj4 = {}
199
+            this.propForm.goodInfo = this.propForm.goodInfo.reduce((cur, next) => {
200
+              obj4[next.id] ? '' : obj4[next.id] = true && cur.push(next)
201
+              return cur
202
+            }, [])
203
+            this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
204
+              obj3[next.id] ? '' : obj3[next.id] = true && cur.push(next)
205
+              return cur
206
+            }, [])
207
+          }
208
+        })
209
+      }, typeName: function(good_type_id) {
210
+        let name = ''
211
+        for (let i = 0; i < this.propForm.goodType.length; i++) {
212
+          if (this.propForm.goodType[i].id == good_type_id) {
213
+            name = this.propForm.goodType[i].type_name
214
+          }
215
+        }
216
+        return name
217
+      }, specificationName: function(good_info_id) {
218
+        let name = ''
219
+        for (let i = 0; i < this.propForm.goodInfo.length; i++) {
220
+          if (this.propForm.goodInfo[i].id == good_info_id) {
221
+            name = this.propForm.goodInfo[i].specification_name
222
+          }
223
+        }
224
+        return name
225
+      }, handleEdit: function(index, row) {
226
+        const tempObj = {}
227
+        tempObj['id'] = 0
228
+        tempObj['good_type_id'] = 0
229
+        tempObj['good_id'] = 0
230
+        tempObj['count'] = ''
231
+        this.recordInfo.recordData.push(tempObj)
232
+      }, handleDelete: function(index, row) {
233
+        if (row.id == 0) {
234
+          this.recordInfo.recordData.splice(index, 1)
235
+        } else {
236
+          const params = {
237
+            id: row.id
238
+          }
239
+          this.$confirm('确认删除该退货物品信息记录?', '删除退货物品信息记录', {
240
+            confirmButtonText: '确定',
241
+            cancelButtonText: '取消',
242
+            type: 'warning'
243
+          }).then(() => {
244
+            deleteSalesReturnInfo(params).then(response => {
245
+              if (response.data.state == 0) {
246
+                this.$message.error(response.data.msg)
247
+                return false
248
+              } else {
249
+                this.$notify({
250
+                  title: '成功',
251
+                  message: '删除成功',
252
+                  type: 'success',
253
+                  duration: 2000
254
+                })
255
+                this.recordInfo.recordData.splice(index, 1)
256
+              }
257
+            })
258
+          }).catch(() => {
259
+          })
260
+        }
261
+      }, getTime(val, temp) {
262
+        if (val != 0) {
263
+          return uParseTime(val, temp)
264
+        } else {
265
+          return ''
266
+        }
267
+      }, showDialog(index, row) {
268
+        this.currentIndex = index
269
+
270
+        this.isVisibility = true
271
+        console.log(this.form.manufacturer)
272
+        for (let i = 0; i < this.propForm.goodInfo.length; i++) {
273
+          if (this.propForm.goodInfo[i].manufacturer == this.form.manufacturer) {
274
+            this.propForm.goodType.push(this.propForm.goodInfo[i].GoodsType)
275
+          }
276
+        }
277
+        const obj3 = {}
278
+        this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
279
+          obj3[next.id] ? '' : obj3[next.id] = true && cur.push(next)
280
+          return cur
281
+        }, [])
282
+
283
+      }, back() {
284
+        this.$router.go(-1)
285
+      }, submit() {
286
+        this.$refs['tableForm'].validate((valid) => {
287
+          if (valid) {
288
+            const array = this.recordInfo.recordData
289
+            for (let i = 0; i < array.length; i++) {
290
+              if (array[i].good_type_id == 0) {
291
+                this.$message.error('物品类型不能为空')
292
+                return
293
+              }
294
+              if (array[i].good_id == 0) {
295
+                this.$message.error('规格名称不能为空')
296
+                return
297
+              }
298
+            }
299
+
300
+            const params = {
301
+              'salesReturn': this.recordInfo.recordData
302
+            }
303
+            editSalesReturnInfo(params, this.return_time, this.$route.query.id).then(response => {
304
+              if (response.data.state == 0) {
305
+                this.$message.error(response.data.msg)
306
+                return false
307
+              } else {
308
+                this.$notify({
309
+                  title: '成功',
310
+                  message: '退货成功',
311
+                  type: 'success',
312
+                  duration: 2000
313
+                })
314
+                this.$router.back(-1)
315
+              }
316
+            })
317
+          } else {
318
+            return false
319
+          }
320
+        })
321
+      }, GetOrderDetail: function(order_id) {
322
+        const params = {
323
+          'id': order_id
324
+        }
325
+        getReturnList(params).then(response => {
326
+          if (response.data.state == 0) {
327
+            this.$message.error(response.data.msg)
328
+            return false
329
+          } else {
330
+            for (let i = 0; i < response.data.data.list.length; i++) {
331
+              this.recordInfo.list[i].count =  this.recordInfo.list[i].count.toString();
332
+              this.recordInfo.recordData.push(response.data.data.list[i])
333
+            }
334
+            this.salesReturn = response.data.data.salesReturn
335
+            this.return_time = this.getTime(this.salesReturn.return_time, '{y}-{m}-{d}')
336
+            this.form.manufacturer = this.salesReturn.manufacturer
337
+            this.form.dealer = this.salesReturn.dealer
338
+          }
339
+        })
340
+      }
341
+    },
342
+    created() {
343
+      this.GetConfigInfo()
344
+      this.propForm.goodUnit = this.$store.getters.good_unit
345
+      const order_id = this.$route.query.id
346
+      this.GetOrderDetail(order_id)
347
+    }
348
+
349
+  }
350
+</script>
351
+
352
+<style rel="stylesheet/css" lang="scss" scoped>
353
+  .information {
354
+    border: 1px #dcdfe6 solid;
355
+    padding: 30px 20px 30px 20px;
356
+
357
+  .border {
358
+    border-bottom: 1px #dcdfe6 solid;
359
+    margin: 0px 0 20px 0;
360
+  }
361
+
362
+  }
363
+
364
+  .title {
365
+    background: #409eff;
366
+    height: 44px;
367
+    line-height: 44px;
368
+    padding: 0 0 0 10px;
369
+    color: #fff;
370
+    margin: 0 0 10px 0;
371
+    border-radius: 4px 4px 0 0;
372
+  }
373
+
374
+  .edit_separater {
375
+    border-top: 1px solid rgb(233, 233, 233);
376
+    margin-top: 15px;
377
+    margin-bottom: 15px;
378
+  }
379
+
380
+</style>
381
+
382
+<style>
383
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
384
+    font-size: 12px;
385
+  }
386
+
387
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
388
+    background: #6fb5fa;
389
+  }
390
+
391
+</style>

+ 24 - 0
src/xt_pages/stock/otherStockInDetail.vue Целия файл

@@ -0,0 +1,24 @@
1
+<template>
2
+  <other-stock-in-order-detail v-if="isEdit == 0"   v-on:edit-record="isEdit = 1"></other-stock-in-order-detail>
3
+  <other-stock-in-order-edit v-else></other-stock-in-order-edit>
4
+</template>
5
+
6
+<script>
7
+  import OtherStockInOrderEdit from './otherStockInOrderEdit'
8
+  import OtherStockInOrderDetail from './otherStockInOrderDetail'
9
+  export default {
10
+    name: 'otherStockInDetail',
11
+    components: { OtherStockInOrderDetail, OtherStockInOrderEdit },
12
+    data() {
13
+      return {
14
+        isEdit: 0
15
+      }
16
+    }
17
+
18
+  }
19
+
20
+</script>
21
+
22
+<style scoped>
23
+
24
+</style>

+ 506 - 0
src/xt_pages/stock/otherStockInOrder.vue Целия файл

@@ -0,0 +1,506 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+
6
+    <div class="filter-container">
7
+
8
+
9
+      <el-row style="float:right;">
10
+        <el-button @click="handleWarehouse" type="primary">新增</el-button>
11
+      </el-row>
12
+    </div>
13
+
14
+    <div class="filter-container" style="margin-top:20px">
15
+      <el-input style="width: 300px;" class="filter-item" placeholder="单据日期/单据编码/制单人/供应商"/>
16
+      <el-button class="filter-item" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
17
+    </div>
18
+
19
+    <div class="filter-container">
20
+      <span>入库时间:</span>
21
+      <el-date-picker v-model="start_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
22
+                      type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
23
+                      value-format="yyyy-MM-dd" @change="startTimeChange"></el-date-picker>
24
+      <span class="">-</span>
25
+      <el-date-picker v-model="end_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
26
+                      type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
27
+                      value-format="yyyy-MM-dd" @change="endTimeChange"></el-date-picker>
28
+    </div>
29
+
30
+    <div class="filter-container" style="margin-top: 10px">
31
+      <el-checkbox style="width: 30px" v-model="checked" @change="changeAllSelected">全选</el-checkbox>
32
+      <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
33
+
34
+    </div>
35
+
36
+    <el-row :gutter="12" style="margin-top: 10px">
37
+      <el-table
38
+        :data="Warehouse.warehouseDate"
39
+        :class="signAndWeighBoxPatients"
40
+        style="width: 100%" border
41
+        highlight-current-row
42
+        v-loading="Warehouse.loading"
43
+        ref="multipleTable"
44
+        @selection-change="select"
45
+
46
+      >
47
+        <el-table-column
48
+          type="selection"
49
+          width="55">
50
+        </el-table-column>
51
+
52
+        <el-table-column label="单据日期" align="center">
53
+          <template slot-scope="scope">
54
+            {{ scope.row.warehousing_time | parseTime('{y}-{m}-{d}')}}
55
+          </template>
56
+        </el-table-column>
57
+
58
+        <el-table-column label="单据编号" align="center">
59
+          <template slot-scope="scope">
60
+            {{scope.row.warehousing_order}}
61
+          </template>
62
+        </el-table-column>
63
+
64
+        <el-table-column label="制单人" align="center">
65
+          <template slot-scope="scope">
66
+            {{getXuserName(scope.row.creater)}}
67
+          </template>
68
+        </el-table-column>
69
+
70
+
71
+        <el-table-column label="厂家" align="center">
72
+          <template slot-scope="scope">
73
+            {{getManufactuerName(scope.row.manufacturer)}}
74
+          </template>
75
+        </el-table-column>
76
+
77
+        <el-table-column label="经销商" align="center">
78
+          <template slot-scope="scope">
79
+            {{getDealerName(scope.row.dealer)}}
80
+          </template>
81
+        </el-table-column>
82
+
83
+        <el-table-column label="操作" align="center">
84
+          <template slot-scope="scope">
85
+            <el-button
86
+              size="mini"
87
+              type="primary"
88
+              icon="el-icon-edit"
89
+              @click="handleEdit(scope.$index, scope.row)">
90
+            </el-button>
91
+
92
+            <el-button
93
+              size="mini"
94
+              type="danger"
95
+              icon="el-icon-delete"
96
+              @click="handleDelete(scope.$index, scope.row)">
97
+            </el-button>
98
+
99
+          </template>
100
+        </el-table-column>
101
+
102
+      </el-table>
103
+
104
+      <el-pagination
105
+        @size-change="handleSizeChange"
106
+        @current-change="handleCurrentChange"
107
+        :page-sizes="[7]"
108
+        :page-size="7"
109
+        background
110
+        style="margin-top:20px;float: right"
111
+        layout="total, sizes, prev, pager, next, jumper"
112
+        :total="total">
113
+      </el-pagination>
114
+
115
+    </el-row>
116
+  </div>
117
+</template>
118
+
119
+<script>
120
+  import { uParseTime } from '@/utils/tools'
121
+  import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from '@/api/doctor'
122
+  import {
123
+    deleteWarehouseInfo,
124
+    GetAllConfig,
125
+    GetAllGoodInfo,
126
+    GetAllGoodType,
127
+    getWarehouseInfoList,
128
+    getWarehouseList
129
+  } from '@/api/stock'
130
+
131
+  export default {
132
+    name: 'otherStockInOrder',
133
+    created() {
134
+      var year = new Date().getFullYear()
135
+      var month = new Date().getMonth() + 1
136
+      var day = new Date().getDate()
137
+      if (parseInt(month) < 10) {
138
+        month = '0' + month
139
+      }
140
+      if (parseInt(day) < 10) {
141
+        day = '0' + day
142
+      }
143
+      const endTime = year + '-' + month + '-' + day
144
+      this.end_time = endTime
145
+
146
+      var year = new Date().getFullYear()
147
+      var month = new Date().getMonth()
148
+      var day = new Date().getDate()
149
+      if (parseInt(month) < 10) {
150
+        month = '0' + month
151
+      }
152
+      if (parseInt(day) < 10) {
153
+        day = '0' + day
154
+      }
155
+      const startTime = year + '-' + month + '-' + day
156
+      this.start_time = startTime
157
+      this.GetWarehouse()
158
+      this.GetConfigInfo()
159
+      this.fetchAllAdminUsers()
160
+    },
161
+    data() {
162
+      return {
163
+        page: 1,
164
+        limit: 7,
165
+        checked: false,
166
+        total: 0,
167
+        pageTotal: 0,
168
+        pageSelect: 0,
169
+        adminUserOptions: [],
170
+        multipleSelection: [],
171
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
172
+        start_time: '',
173
+        end_time: '',
174
+        goodType: [],
175
+        goodInfo: [],
176
+        manufacturer: [],
177
+        selectedTableData: [],
178
+        dealer: [],
179
+        Warehouse: {
180
+          loading: false,
181
+          warehouseDate: [],
182
+          tableCurrentIndex: ''
183
+        },
184
+
185
+        WarehouseInfo: {
186
+          loading: false,
187
+          warehouseInfoDate: []
188
+        }
189
+      }
190
+    },
191
+    methods: {
192
+      GetWarehouse: function() {
193
+        const Params = {
194
+          page: this.page,
195
+          limit: this.limit,
196
+          start_time: this.start_time,
197
+          end_time: this.end_time
198
+        }
199
+        this.Warehouse.warehouseDate = []
200
+        getWarehouseList(Params).then(response => {
201
+          if (response.data.state == 0) {
202
+            this.Warehouse.loading = false
203
+            this.$message.error(response.data.msg)
204
+            return false
205
+          } else {
206
+            this.Warehouse.loading = false
207
+            this.total = response.data.data.total
208
+            for (let i = 0; i < response.data.data.list.length; i++) {
209
+              this.Warehouse.warehouseDate.push(response.data.data.list[i])
210
+            }
211
+          }
212
+        })
213
+      }, tableRowClassName({ row, rowIndex }) {
214
+        // 把每一行的索引放进row
215
+        row.index = rowIndex
216
+      },
217
+      onRowClick(row, event, column) {
218
+        this.WarehouseInfo.warehouseInfoDate = []
219
+        this.Warehouse.tableCurrentIndex = row.index
220
+        const params = {
221
+          'id': row.id
222
+        }
223
+        this.WarehouseInfo.loading = true
224
+        getWarehouseInfoList(params).then(response => {
225
+          if (response.data.state == 0) {
226
+            this.WarehouseInfo.loading = false
227
+            this.$message.error(response.data.msg)
228
+            return false
229
+          } else {
230
+            this.WarehouseInfo.loading = false
231
+            for (let i = 0; i < response.data.data.info.length; i++) {
232
+              this.WarehouseInfo.warehouseInfoDate.push(response.data.data.info[i])
233
+            }
234
+          }
235
+        })
236
+      }, getXuserName(id) {
237
+        if (id <= 0) {
238
+          return ''
239
+        }
240
+        var name = ''
241
+        if (this.adminUserOptions == null || typeof (this.adminUserOptions.length) === 'undefined') {
242
+          return name
243
+        }
244
+        var leng = this.adminUserOptions.length
245
+        if (leng == 0) {
246
+          return name
247
+        }
248
+        for (let index = 0; index < leng; index++) {
249
+          if (this.adminUserOptions[index].id == id) {
250
+            name = this.adminUserOptions[index].name
251
+            break
252
+          }
253
+        }
254
+        return name
255
+      }, fetchAllDoctorAndNurse() {
256
+        fetchAllDoctorAndNurse().then(response => {
257
+          if (response.data.state == 1) {
258
+            this.doctorOptions = response.data.data.doctors
259
+          }
260
+        })
261
+      },
262
+      fetchAllAdminUsers() {
263
+        fetchAllAdminUsers().then(response => {
264
+          console.log(response)
265
+          if (response.data.state == 1) {
266
+            this.adminUserOptions = response.data.data.users
267
+            var alen = this.adminUserOptions.length
268
+            for (let index = 0; index < alen; index++) {
269
+              if (this.adminUserOptions[index].user_type == 2) {
270
+                // this.doctorOptions.push(this.adminUserOptions[index]);
271
+              }
272
+            }
273
+          }
274
+        })
275
+      }, getSpecificationName: function(id) {
276
+        let name = ''
277
+        for (let i = 0; i < this.goodInfo.length; i++) {
278
+          if (this.goodInfo[i].id == id) {
279
+            name = this.goodInfo[i].specification_name
280
+          }
281
+        }
282
+
283
+        return name
284
+      }, getTypeName: function(id) {
285
+        let name = ''
286
+        for (let i = 0; i < this.goodType.length; i++) {
287
+          if (this.goodType[i].id == id) {
288
+            name = this.goodType[i].type_name
289
+          }
290
+        }
291
+        return name
292
+      }, GetAllGoodType: function() {
293
+        GetAllGoodType().then(response => {
294
+          if (response.data.state == 0) {
295
+            this.$message.error(response.data.msg)
296
+            return false
297
+          } else {
298
+            for (let i = 0; i < response.data.data.goodType.length; i++) {
299
+              this.goodType.push(response.data.data.goodType[i])
300
+            }
301
+          }
302
+        })
303
+      }, GetAllGoodInfo: function() {
304
+        GetAllGoodInfo().then(response => {
305
+          if (response.data.state == 0) {
306
+            this.$message.error(response.data.msg)
307
+            return false
308
+          } else {
309
+            for (let i = 0; i < response.data.data.goodInfo.length; i++) {
310
+              this.goodInfo.push(response.data.data.goodInfo[i])
311
+            }
312
+          }
313
+        })
314
+      }, clicks: function() {
315
+        console.log(this.WarehouseInfo.warehouseInfoDate)
316
+      }, handleWarehouse: function() {
317
+        this.$router.push({ path: '/stock/in/add' })
318
+      }, handleReturnSales: function() {
319
+        // this.$router.push({path:'/patients/create'}
320
+        if (this.multipleSelection.length <= 0) {
321
+          this.$message.error('请选择退货物品')
322
+          return
323
+        }
324
+
325
+        const ids = []
326
+        for (let i = 0; i < this.multipleSelection.length; i++) {
327
+          ids.push(this.multipleSelection[i].id)
328
+        }
329
+        this.$router.push({ name: 'salesReturn', query: { id: ids.join('&') }})
330
+      }, handleReturnSalesRecord: function() {
331
+        this.$router.push({ name: 'salesReutrnRecord' })
332
+      }, handleWarehouseRecord: function() {
333
+        this.$router.push({ name: 'warehouseRecord' })
334
+      }, handleSelectionChange: function(val) {
335
+        this.multipleSelection = val
336
+      }, handleSizeChange(val) {
337
+        this.limit = val
338
+        this.GetWarehouse()
339
+      }, handleCurrentChange(val) {
340
+        this.page = val
341
+        this.GetWarehouse()
342
+      }, startTimeChange(val) {
343
+        this.GetWarehouse()
344
+      }, endTimeChange(val) {
345
+        this.GetWarehouse()
346
+      }, calculate: function(val) {
347
+        return Math.round(parseFloat(val) * 100) / 100
348
+      }, GetConfigInfo: function() {
349
+        GetAllConfig().then(response => {
350
+          if (response.data.state == 0) {
351
+            this.$message.error(response.data.msg)
352
+            return false
353
+          } else {
354
+            this.manufacturer = response.data.data.manufacturer
355
+            this.dealer = response.data.data.dealer
356
+          }
357
+        })
358
+      }, getManufactuerName: function(manufacturer_id) {
359
+        for (let i = 0; i < this.manufacturer.length; i++) {
360
+          if (this.manufacturer[i].id == manufacturer_id) {
361
+            return this.manufacturer[i].manufacturer_name
362
+          }
363
+        }
364
+      }, getDealerName: function(dealer_id) {
365
+        for (let i = 0; i < this.dealer.length; i++) {
366
+          if (this.dealer[i].id == dealer_id) {
367
+            return this.dealer[i].dealer_name
368
+          }
369
+        }
370
+      }, handleEdit: function(index, row) {
371
+        this.$router.push({ name: 'stockInDetail', query: { id: row.id }})
372
+      }, handleDelete: function(index, row) {
373
+        const ids = []
374
+        ids.push(row.id)
375
+        const idStr = ids.join(',')
376
+
377
+        const params = {
378
+          ids: idStr
379
+        }
380
+
381
+        this.$confirm('确认删除入库单记录?', '删除入库单记录', {
382
+          confirmButtonText: '确定',
383
+          cancelButtonText: '取消',
384
+          type: 'warning'
385
+        }).then(() => {
386
+          deleteWarehouseInfo(params).then(response => {
387
+            if (response.data.state == 0) {
388
+              this.$message.error(response.data.msg)
389
+              return false
390
+            } else {
391
+              this.$notify({
392
+                title: '成功',
393
+                message: '删除成功',
394
+                type: 'success',
395
+                duration: 2000
396
+              })
397
+              for (let i = 0; i < ids.length; i++) {
398
+                for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
399
+                  if (ids[i] == this.Warehouse.warehouseDate[y].id) {
400
+                    this.Warehouse.warehouseDate.splice(y, 1)
401
+                  }
402
+                }
403
+              }
404
+            }
405
+          })
406
+        }).catch(() => {
407
+        })
408
+      }, changeAllSelected: function(val) {
409
+        if (val) {
410
+          this.$refs.multipleTable.toggleAllSelection()
411
+        } else {
412
+          this.$refs.multipleTable.clearSelection()
413
+        }
414
+      }, select(selection) {
415
+        this.selectedTableData = selection
416
+      }, batchDelete() {
417
+        if (this.selectedTableData.length <= 0) {
418
+          this.$message.error('请选择要删除的记录')
419
+          return
420
+        }
421
+        const ids = []
422
+        for (let i = 0; i < this.selectedTableData.length; i++) {
423
+          ids.push(this.selectedTableData[i].id)
424
+        }
425
+        const idStr = ids.join(',')
426
+        const params = {
427
+          ids: idStr
428
+        }
429
+        this.$confirm('确认删除入库单记录?', '删除入库单记录', {
430
+          confirmButtonText: '确定',
431
+          cancelButtonText: '取消',
432
+          type: 'warning'
433
+        }).then(() => {
434
+          deleteWarehouseInfo(params).then(response => {
435
+            if (response.data.state == 0) {
436
+              this.$message.error(response.data.msg)
437
+              return false
438
+            } else {
439
+              this.$notify({
440
+                title: '成功',
441
+                message: '删除成功',
442
+                type: 'success',
443
+                duration: 2000
444
+              })
445
+
446
+              for (let i = 0; i < ids.length; i++) {
447
+                for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
448
+                  if (ids[i] == this.Warehouse.warehouseDate[y].id) {
449
+                    this.Warehouse.warehouseDate.splice(y, 1)
450
+                  }
451
+                }
452
+              }
453
+            }
454
+          })
455
+        }).catch(() => {
456
+        })
457
+      }
458
+    }
459
+  }
460
+</script>
461
+
462
+<style rel="stylesheet/css" lang="scss" scoped>
463
+  .information {
464
+    border: 1px #dcdfe6 solid;
465
+    padding: 30px 20px 30px 20px;
466
+
467
+  .border {
468
+    border-bottom: 1px #dcdfe6 solid;
469
+    margin: 0px 0 20px 0;
470
+  }
471
+
472
+  }
473
+
474
+  .title {
475
+    background: #409eff;
476
+    height: 44px;
477
+    line-height: 44px;
478
+    padding: 0 0 0 10px;
479
+    color: #fff;
480
+    margin: 0 0 10px 0;
481
+
482
+  }
483
+
484
+  .edit_separater {
485
+    border-top: 1px solid rgb(233, 233, 233);
486
+    margin-top: 15px;
487
+    margin-bottom: 15px;
488
+  }
489
+
490
+</style>
491
+
492
+<style>
493
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
494
+    font-size: 12px;
495
+  }
496
+
497
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
498
+    background: #6fb5fa;
499
+  }
500
+
501
+  .count {
502
+    color: #bd2c00;
503
+
504
+  }
505
+
506
+</style>

+ 611 - 0
src/xt_pages/stock/otherStockInOrderAdd.vue Целия файл

@@ -0,0 +1,611 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <stock-in-dialog :propForm="propForm"
6
+                     :visibility="isVisibility"
7
+                     v-on:dialog-comfirm="comfirm"
8
+                     v-on:dialog-cancle="cancle"></stock-in-dialog>
9
+
10
+    <div class="filter-container">
11
+
12
+      <el-row>
13
+        <el-col :span="8"><div>
14
+          <span>入库时间:</span>
15
+          <el-date-picker v-model="warehousing_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
16
+                          type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
17
+                          value-format="yyyy-MM-dd"></el-date-picker>
18
+        </div></el-col>
19
+
20
+
21
+        <el-col :span="8">
22
+          <div>
23
+            <el-form ref="form" :model="form" :rules="ruleForm" label-width="80px">
24
+              <el-form-item label="厂商:" prop="manufacturer">
25
+                <el-select v-model="form.manufacturer" placeholder="请选择厂商">
26
+                  <el-option v-for="(option, index) in manufacturer" :key="index" :label="option.manufacturer_name" :value="option.id"></el-option>
27
+                </el-select>
28
+              </el-form-item>
29
+            </el-form>
30
+          </div>
31
+        </el-col>
32
+        <el-col :span="8">
33
+          <div>
34
+            <el-form ref="form" :model="form" label-width="80px">
35
+              <el-form-item label="经销商:">
36
+                <el-select v-model="form.dealer" placeholder="请选择经销商">
37
+                  <el-option v-for="(option, index) in dealer" :key="index" :label="option.dealer_name" :value="option.id"></el-option>
38
+                </el-select>
39
+              </el-form-item>
40
+            </el-form>
41
+          </div>
42
+        </el-col>
43
+      </el-row>
44
+
45
+    </div>
46
+
47
+    <el-row>
48
+      <el-col>
49
+        <el-form  :rules="tableRules" :model="recordInfo" ref="tableForm">
50
+          <el-table :data="recordInfo.recordData" :class="signAndWeighBoxPatients" style="width: 100%" border
51
+                    max-height="450"
52
+          >
53
+
54
+            <el-table-column label="操作" align="center" min-width="30">
55
+              <template slot-scope="scope">
56
+                <el-button
57
+                  size="mini"
58
+                  @click="handleEdit(scope.$index, scope.row)">+
59
+                </el-button>
60
+                <el-button
61
+                  size="mini"
62
+                  type="danger"
63
+                  @click="handleDelete(scope.$index, scope.row)">-
64
+                </el-button>
65
+              </template>
66
+            </el-table-column>
67
+
68
+            <el-table-column min-width="35" align="center">
69
+
70
+              <template slot="header" slot-scope="scope">
71
+                <span>物品类型<span style="color: red">*</span></span>
72
+              </template>
73
+
74
+              <template slot-scope="scope" >
75
+                <!--<span @click="showDialog(scope.$index, scope.row)" v-if="scope.row.good_type_id == 0" style="color:#c5c8cf">请输入类型</span>-->
76
+                <!--<span @click="showDialog(scope.$index, scope.row)" v-if="scope.row.good_type_id != 0">{{typeName(scope.row.good_type_id)}}</span>-->
77
+
78
+                <el-form-item  style="padding-top: 15px">
79
+                  <el-input placeholder="请输入物品类型"  v-model="scope.row.good_type_id" :value="typeName(scope.row.good_type_id)" @focus="showDialog(scope.$index, scope.row)" ></el-input>
80
+                </el-form-item>
81
+
82
+              </template>
83
+            </el-table-column>
84
+            <el-table-column min-width="35" align="center">
85
+              <template slot="header" slot-scope="scope">
86
+                <span>规格名称<span style="color: red">*</span></span>
87
+              </template>
88
+              <template slot-scope="scope">
89
+
90
+                <el-form-item  style="padding-top: 15px">
91
+                  <el-input placeholder="请输入规格名称"  v-model="scope.row.good_id" :value="specificationName(scope.row.good_id)" @focus="showDialog(scope.$index, scope.row)" ></el-input>
92
+                </el-form-item>
93
+
94
+              </template>
95
+            </el-table-column>
96
+
97
+
98
+            <el-table-column  min-width="23" align="center">
99
+              <template slot="header" slot-scope="scope">
100
+                <span>单价<span style="color: red">*</span></span>
101
+              </template>
102
+              <template slot-scope="scope">
103
+                <!--<el-input type="number" v-model="scope.row.price"  @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
104
+                <el-form-item :prop="'recordData.' + scope.$index + '.price'" :rules='tableRules.price' style="padding-top: 17px">
105
+                  <el-input type="number"  v-model="scope.row.price" ></el-input>
106
+                </el-form-item>
107
+
108
+
109
+              </template>
110
+            </el-table-column>
111
+
112
+            <el-table-column  min-width="23" align="center">
113
+              <template slot="header" slot-scope="scope">
114
+                <span>入库数量<span style="color: red">*</span></span>
115
+              </template>
116
+              <template slot-scope="scope">
117
+                <!--{{scope.row.warehousing_count}}-->
118
+                <!--<el-input type="number" v-model="scope.row.warehousing_count"   @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
119
+
120
+                <el-form-item :prop="'recordData.' + scope.$index + '.warehousing_count'" :rules='tableRules.warehousing_count' style="padding-top: 17px">
121
+                  <el-input type="number"  v-model="scope.row.warehousing_count" ></el-input>
122
+                </el-form-item>
123
+              </template>
124
+            </el-table-column>
125
+
126
+            <el-table-column label="总价" min-width="20" align="center">
127
+              <template slot-scope="scope">
128
+                {{calculate(scope.row.price*scope.row.warehousing_count)}}
129
+              </template>
130
+            </el-table-column>
131
+
132
+            <el-table-column  align="center" min-width="25">
133
+              <template slot="header" slot-scope="scope">
134
+                <span>批号<span style="color: red">*</span></span>
135
+              </template>
136
+              <template slot-scope="scope">
137
+                <!--<el-input  v-model="scope.row.numbers"></el-input>-->
138
+
139
+                <el-form-item :prop="'recordData.' + scope.$index + '.number'" :rules='tableRules.number' style="padding-top: 17px">
140
+                  <el-input  v-model="scope.row.number" ></el-input>
141
+                </el-form-item>
142
+
143
+              </template>
144
+            </el-table-column>
145
+            <el-table-column label="生产日期" min-width="40" align="center">
146
+              <template slot-scope="scope" >
147
+                <!--{{scope.row.product_date | parseTime("{y}-{m}-{d}")}}-->
148
+                <el-date-picker prefix-icon="el-icon-date" style="width: 145px" v-model="scope.row.product_date"
149
+                                type="date" placeholder="选择日期时间" format="yyyy-MM-dd"
150
+                                value-format="yyyy-MM-dd"></el-date-picker>
151
+
152
+              </template>
153
+            </el-table-column>
154
+            <el-table-column label="有效日期" min-width="40" align="center">
155
+              <template slot-scope="scope">
156
+                <!--{{ scope.row.expiry_date | parseTime("{y}-{m}-{d}")}}-->
157
+                <el-date-picker  prefix-icon="el-icon-date" style="width: 145px" v-model="scope.row.expiry_date"
158
+                                 type="date" placeholder="选择日期时间"  format="yyyy-MM-dd"
159
+                                 value-format="yyyy-MM-dd"></el-date-picker>
160
+
161
+              </template>
162
+            </el-table-column>
163
+            <el-table-column label="备注" min-width="20" align="center">
164
+              <template slot-scope="scope">
165
+                <el-input  v-model="scope.row.remark"></el-input>
166
+              </template>
167
+            </el-table-column>
168
+          </el-table>
169
+        </el-form>
170
+      </el-col>
171
+
172
+
173
+      <span  class="dialog-footer" style="margin-top: 20px;float:right">
174
+        <el-button @click="back()">取 消</el-button>
175
+        <el-button type="primary" @click="submit()">确 定</el-button>
176
+      </span>
177
+
178
+    </el-row>
179
+  </div>
180
+</template>
181
+
182
+<script>
183
+  import stockInDialog from './Dialog/stockInDialog'
184
+  import { uParseTime } from '@/utils/tools'
185
+
186
+  import {
187
+    GetAllGoodInfo,
188
+    GetAllGoodType,
189
+    postWarehouse,
190
+    GetAllConfig,
191
+    GetAllGoodInfoByID,
192
+    getWarehouseInfoByOrdeNumber,
193
+    modifyWarehouseInfo,
194
+    deleteWarehouseInfo
195
+  } from '@/api/stock'
196
+
197
+  export default {
198
+    components: { stockInDialog },
199
+    name: 'stockIn',
200
+
201
+    data() {
202
+      var checkGoodId = (rule, value, callback) => {
203
+        setTimeout(() => {
204
+          if (value == '' || value == 0) {
205
+            return callback(new Error('规格名称不能为空'))
206
+          }
207
+        }, 2000)
208
+      }
209
+
210
+      return {
211
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
212
+        warehousing_time: '',
213
+        adminUserOptions: null,
214
+        currentIndex: 0,
215
+
216
+        recordInfo: {
217
+          recordData: [],
218
+          stock_in_code: '',
219
+          current_index: ''
220
+
221
+        },
222
+        tableRules: {
223
+          price: [
224
+            { required: true, message: '单价不能为空', trigger: 'blur' }
225
+          ],
226
+          warehousing_count: [
227
+            { required: true, message: '数量不能为空', trigge: 'blur' }
228
+          ],
229
+          number: [
230
+            { required: true, message: '批号不能为空', trigge: 'blur' }
231
+          ],
232
+          good_id: [
233
+            { validator: checkGoodId, trigger: 'blur' }
234
+          ]
235
+
236
+        },
237
+        ruleForm: {
238
+          manufacturer: [
239
+            { required: true, message: '请选择厂商', trigger: 'change' }
240
+          ]
241
+
242
+        },
243
+
244
+        total: '',
245
+        product_date: '',
246
+        expiry_date: '',
247
+        numbers: '',
248
+
249
+        // prop
250
+        isVisibility: false,
251
+        propForm: {
252
+          goodType: [],
253
+          goodInfo: [],
254
+          goodUnit: [],
255
+          title: '入库',
256
+          formValue: {
257
+            good_type_id: '',
258
+            good_id: '',
259
+            number: '',
260
+            product_date: '',
261
+            expiry_date: '',
262
+            warehousing_count: '',
263
+            price: '',
264
+            remark: '',
265
+            dealer: '',
266
+            manufacturer: ''
267
+
268
+          },
269
+          isCreated: 1
270
+
271
+        },
272
+
273
+        goodInfo: {
274
+          loading: false,
275
+          goodTypeData: [],
276
+          type_code: ''
277
+        },
278
+        form: {
279
+          manufacturer: '',
280
+          dealer: ''
281
+        },
282
+
283
+        formValue: {
284
+          good_type_id: '',
285
+          good_id: '',
286
+          number: '',
287
+          product_date: '',
288
+          expiry_date: '',
289
+          warehousing_count: '',
290
+          price: '',
291
+          remark: '',
292
+          dealer: '',
293
+          manufacturer: ''
294
+
295
+        },
296
+
297
+        manufacturer: [],
298
+        dealer: [],
299
+        goodType: []
300
+      }
301
+    },
302
+    methods: {
303
+      handleSave: function() {
304
+        if (this.recordInfo.recordData.length <= 0) {
305
+          this.$message.error('请添加入库信息')
306
+          return
307
+        }
308
+        sessionStorage.removeItem('warehousing_orders')
309
+        this.$router.back(-1)
310
+      }, handleCancle: function() {
311
+        this.$confirm('是否放弃编辑返回上一页?', '放弃编辑', {
312
+          confirmButtonText: '确定',
313
+          cancelButtonText: '取消',
314
+          type: 'warning'
315
+        }).then(() => {
316
+          sessionStorage.removeItem('warehousing_orders')
317
+          this.$router.back(-1)
318
+        }).catch(() => {
319
+
320
+        })
321
+      }, handleCreate: function() {
322
+        this.propForm.formValue = {}
323
+        this.propForm.isCreated = 1
324
+        this.isVisibility = true
325
+      }, comfirm: function(val) {
326
+        this.isVisibility = false
327
+        if (val.selectedGoodInfo.length > 0) {
328
+          for (let i = val.selectedGoodInfo.length - 1; ;i--) {
329
+            if (i == 0) {
330
+              this.recordInfo.recordData[this.currentIndex].good_type_id = val.goodTypeId
331
+              this.recordInfo.recordData[this.currentIndex].good_id = val.selectedGoodInfo[i].id
332
+            } else {
333
+              const tempForm = {}
334
+              tempForm['good_type_id'] = val.goodTypeId
335
+              tempForm['good_id'] = val.selectedGoodInfo[i].id
336
+              tempForm['number'] = ''
337
+              tempForm['product_date'] = 0
338
+              tempForm['expiry_date'] = 0
339
+              tempForm['warehousing_count'] = ''
340
+              tempForm['price'] = ''
341
+              tempForm['remark'] = ''
342
+              tempForm['dealer'] = ''
343
+              tempForm['manufacturer'] = ''
344
+              this.recordInfo.recordData.push(tempForm)
345
+            }
346
+          }
347
+        }
348
+
349
+        this.currentIndex = -1
350
+      }, cancle: function() {
351
+        this.isVisibility = false
352
+      }, GetAllGoodType: function() {
353
+        GetAllGoodType().then(response => {
354
+          if (response.data.state == 0) {
355
+            this.$message.error(response.data.msg)
356
+            return false
357
+          } else {
358
+            for (let i = 0; i < response.data.data.goodType.length; i++) {
359
+              this.propForm.goodType.push(response.data.data.goodType[i])
360
+            }
361
+          }
362
+        })
363
+      }, GetAllGoodInfo: function() {
364
+        GetAllGoodInfo().then(response => {
365
+          if (response.data.state == 0) {
366
+            this.$message.error(response.data.msg)
367
+            return false
368
+          } else {
369
+            for (let i = 0; i < response.data.data.goodInfo.length; i++) {
370
+              this.propForm.goodInfo.push(response.data.data.goodInfo[i])
371
+            }
372
+          }
373
+        })
374
+      }, GetConfigInfo: function() {
375
+        GetAllConfig().then(response => {
376
+          if (response.data.state == 0) {
377
+            this.$message.error(response.data.msg)
378
+            return false
379
+          } else {
380
+            this.manufacturer = response.data.data.manufacturer
381
+            this.dealer = response.data.data.dealer
382
+            this.goodType = response.data.data.goodType
383
+            this.goodInfo = response.data.data.goodInfo
384
+          }
385
+        })
386
+      }, typeName: function(good_type_id) {
387
+        let name = '请输入物品类型'
388
+        for (let i = 0; i < this.goodType.length; i++) {
389
+          if (this.goodType[i].id == good_type_id) {
390
+            name = this.goodType[i].type_name
391
+          }
392
+        }
393
+        return name
394
+      }, specificationName: function(good_info_id) {
395
+        let name = ''
396
+        for (let i = 0; i < this.goodInfo.length; i++) {
397
+          if (this.goodInfo[i].id == good_info_id) {
398
+            name = this.goodInfo[i].specification_name
399
+          }
400
+        }
401
+        return name
402
+      }, handleEdit: function(index, row) {
403
+        const tempObj = {}
404
+        tempObj['good_type_id'] = 0
405
+        tempObj['good_id'] = 0
406
+        tempObj['number'] = ''
407
+        tempObj['product_date'] = ''
408
+        tempObj['expiry_date'] = ''
409
+        tempObj['warehousing_count'] = ''
410
+        tempObj['price'] = ''
411
+        tempObj['remark'] = ''
412
+        tempObj['dealer'] = ''
413
+        tempObj['manufacturer'] = ''
414
+        this.recordInfo.recordData.push(tempObj)
415
+      }, handleDelete: function(index, row) {
416
+        this.recordInfo.recordData.splice(index, 1)
417
+      }, calculate: function(val) {
418
+        if (val == 0) {
419
+          return ''
420
+        }
421
+        return Math.round(parseFloat(val) * 100) / 100
422
+      }, GetWarehouseInfoByOrdeNumber: function() {
423
+        const params = {
424
+          'warehousing_order': sessionStorage.getItem('warehousing_orders')
425
+        }
426
+        this.recordInfo.recordData = []
427
+        getWarehouseInfoByOrdeNumber(params).then(response => {
428
+          if (response.data.state != 0) {
429
+            for (let i = 0; i < response.data.data.info.length; i++) {
430
+              this.recordInfo.recordData.push(response.data.data.info[i])
431
+            }
432
+          }
433
+        })
434
+      }, getTime(val, temp) {
435
+        if (val != 0) {
436
+          return uParseTime(val, temp)
437
+        } else {
438
+          return ''
439
+        }
440
+      }, showDialog(index, row) {
441
+        this.currentIndex = index
442
+        if (this.form.manufacturer == '' || this.form.manufacturer == 0) {
443
+          this.$message.error('请先选择厂商')
444
+          return
445
+        } else {
446
+          this.isVisibility = true
447
+          const params = {
448
+            id: this.form.manufacturer
449
+          }
450
+          GetAllGoodInfoByID(params).then(response => {
451
+            if (response.data.state == 0) {
452
+              this.$message.error(response.data.msg)
453
+              return false
454
+            } else {
455
+              if (response.data.data.goodInfo.length == 0) {
456
+                this.$message.error('该厂商没商品,请添加商品')
457
+              } else {
458
+                for (let i = 0; i < response.data.data.goodInfo.length; i++) {
459
+                  this.propForm.goodType.push(response.data.data.goodInfo[i].GoodsType)
460
+                }
461
+
462
+                const obj = {}
463
+                this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
464
+                  obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
465
+                  return cur
466
+                }, []) // 设置cur默认类型为数组,并且初始值为空的数组
467
+              }
468
+            }
469
+          })
470
+        }
471
+      }, getSummaries(param) {
472
+        const { columns, data } = param
473
+        const sums = []
474
+        columns.forEach((column, index) => {
475
+          if (index === 0) {
476
+            sums[index] = '总价'
477
+            return
478
+          }
479
+          const values = data.map(item => Number(item[column.property]))
480
+          if (!values.every(value => isNaN(value))) {
481
+            sums[index] = values.reduce((prev, curr) => {
482
+              const value = Number(curr)
483
+              if (!isNaN(value)) {
484
+                return prev + curr
485
+              } else {
486
+                return prev
487
+              }
488
+            }, 0)
489
+            sums[index] += ' 元'
490
+          } else {
491
+            sums[index] = 'N/A'
492
+          }
493
+        })
494
+
495
+        return sums
496
+      }, back() {
497
+        this.$router.go(-1)
498
+      }, submit() {
499
+        this.$refs['tableForm'].validate((valid) => {
500
+          if (valid) {
501
+            if (this.form.manufacturer == 0) {
502
+              this.$message.error('厂商不能为空')
503
+              return
504
+            }
505
+            const array = this.recordInfo.recordData
506
+            for (let i = 0; i < array.length; i++) {
507
+              if (array[i].good_type_id == 0) {
508
+                this.$message.error('物品类型不能为空')
509
+                return
510
+              }
511
+              if (array[i].good_id == 0) {
512
+                this.$message.error('规格名称不能为空')
513
+                return
514
+              }
515
+            }
516
+
517
+            const params = {
518
+              'stockIn': this.recordInfo.recordData
519
+            }
520
+            postWarehouse(params, this.warehousing_time, this.form.manufacturer, this.form.dealer).then(response => {
521
+              if (response.data.state == 0) {
522
+                this.$message.error(response.data.msg)
523
+                return false
524
+              } else {
525
+                this.$notify({
526
+                  title: '成功',
527
+                  message: '入库成功',
528
+                  type: 'success',
529
+                  duration: 2000
530
+                })
531
+                this.$router.back(-1)
532
+              }
533
+            })
534
+          } else {
535
+            return false
536
+          }
537
+        })
538
+      }
539
+    },
540
+    created() {
541
+      var year = new Date().getFullYear()
542
+      var month = new Date().getMonth() + 1
543
+      var day = new Date().getDate()
544
+      if (parseInt(month) < 10) {
545
+        month = '0' + month
546
+      }
547
+      if (parseInt(day) < 10) {
548
+        day = '0' + day
549
+      }
550
+      const endTime = year + '-' + month + '-' + day
551
+      this.warehousing_time = endTime
552
+
553
+      const tempObj = {}
554
+      tempObj['good_type_id'] = 0
555
+      tempObj['good_id'] = 0
556
+      tempObj['number'] = ''
557
+      tempObj['product_date'] = ''
558
+      tempObj['expiry_date'] = ''
559
+      tempObj['warehousing_count'] = ''
560
+      tempObj['price'] = ''
561
+      tempObj['remark'] = ''
562
+      tempObj['dealer'] = ''
563
+      tempObj['manufacturer'] = ''
564
+
565
+      this.recordInfo.recordData.push(tempObj)
566
+      this.GetConfigInfo()
567
+      this.propForm.goodUnit = this.$store.getters.good_unit
568
+    }
569
+
570
+  }
571
+</script>
572
+
573
+<style rel="stylesheet/css" lang="scss" scoped>
574
+  .information {
575
+    border: 1px #dcdfe6 solid;
576
+    padding: 30px 20px 30px 20px;
577
+
578
+  .border {
579
+    border-bottom: 1px #dcdfe6 solid;
580
+    margin: 0px 0 20px 0;
581
+  }
582
+  }
583
+
584
+  .title {
585
+    background: #409eff;
586
+    height: 44px;
587
+    line-height: 44px;
588
+    padding: 0 0 0 10px;
589
+    color: #fff;
590
+    margin: 0 0 10px 0;
591
+  // border-radius: 4px 4px 0 0;
592
+  }
593
+
594
+  .edit_separater {
595
+    border-top: 1px solid rgb(233, 233, 233);
596
+    margin-top: 15px;
597
+    margin-bottom: 15px;
598
+  }
599
+
600
+</style>
601
+
602
+<style>
603
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
604
+    font-size: 12px;
605
+  }
606
+
607
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
608
+    background: #6fb5fa;
609
+  }
610
+
611
+</style>

+ 281 - 0
src/xt_pages/stock/otherStockInOrderDetail.vue Целия файл

@@ -0,0 +1,281 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <div class="filter-container">
6
+      <span style="font-size: 20px">耗材入库单详情</span>
7
+      <el-row style="float:right;">
8
+        <span>{{WarehouseInfo.warehouse.warehousing_order}}</span>
9
+      </el-row>
10
+    </div>
11
+
12
+
13
+
14
+    <div class="filter-container">
15
+      <span>单据日期:  {{WarehouseInfo.warehouse.warehousing_time | parseTime('{y}-{m}-{d}')}} </span>
16
+      <span>厂商 {{getManufactuerName(WarehouseInfo.warehouse.manufacturer)}}</span>
17
+      <span>经销商 {{getDealerName(WarehouseInfo.warehouse.dealer)}}</span>
18
+    </div>
19
+
20
+    <div class="filter-container" style="margin-top: 10px">
21
+      <el-button size="small" icon="el-icon-edit" @click="editRecord">编辑</el-button>
22
+      <el-button size="small" icon="el-icon-delete" @click="deleteRecord">删除</el-button>
23
+    </div>
24
+
25
+    <el-row :gutter="12" style="margin-top: 10px">
26
+      <el-table :data="WarehouseInfo.warehouseInfoDate" :class="signAndWeighBoxPatients" style="width: 100%" border
27
+      >
28
+        <el-table-column min-width="35" align="center">
29
+          <template slot="header" slot-scope="scope">
30
+            <span>物品类型</span>
31
+          </template>
32
+
33
+          <template slot-scope="scope">
34
+            <span v-if="scope.row.good_type_id != 0">{{getTypeName(scope.row.good_type_id)}}</span>
35
+          </template>
36
+        </el-table-column>
37
+        <el-table-column min-width="35" align="center">
38
+          <template slot="header" slot-scope="scope">
39
+            <span>规格名称</span>
40
+          </template>
41
+          <template slot-scope="scope">
42
+            <span v-if="scope.row.good_id != 0">{{getSpecificationName(scope.row.good_id)}}</span>
43
+          </template>
44
+        </el-table-column>
45
+
46
+
47
+        <el-table-column min-width="23" align="center">
48
+          <template slot="header" slot-scope="scope">
49
+            <span>单价</span>
50
+          </template>
51
+          <template slot-scope="scope">
52
+            <span>{{scope.row.price}}</span>
53
+          </template>
54
+        </el-table-column>
55
+
56
+        <el-table-column min-width="23" align="center">
57
+          <template slot="header" slot-scope="scope">
58
+            <span>入库数量</span>
59
+          </template>
60
+          <template slot-scope="scope">
61
+            <span>{{scope.row.warehousing_count}}</span>
62
+
63
+          </template>
64
+        </el-table-column>
65
+
66
+        <el-table-column label="总价" min-width="20" align="center">
67
+          <template slot-scope="scope">
68
+            {{calculate(scope.row.price*scope.row.warehousing_count)}}
69
+          </template>
70
+        </el-table-column>
71
+
72
+        <el-table-column align="center" min-width="25">
73
+          <template slot="header" slot-scope="scope">
74
+            <span>批号</span>
75
+          </template>
76
+          <template slot-scope="scope">
77
+            <span>{{scope.row.number}}</span>
78
+          </template>
79
+        </el-table-column>
80
+        <el-table-column label="生产日期" min-width="40" align="center">
81
+          <template slot-scope="scope">
82
+            {{scope.row.product_date | parseTime('{y}-{m}-{d}')}}
83
+
84
+          </template>
85
+        </el-table-column>
86
+        <el-table-column label="有效日期" min-width="40" align="center">
87
+          <template slot-scope="scope">
88
+            {{ scope.row.expiry_date | parseTime('{y}-{m}-{d}')}}
89
+          </template>
90
+        </el-table-column>
91
+        <el-table-column label="备注" min-width="20"  align="center">
92
+          <template slot-scope="scope">
93
+            <el-popover placement="top-start"  width="250" trigger="hover" >
94
+              <div>{{scope.row.remark}}</div>
95
+              <span slot="reference" v-if="scope.row.remark.length > 20">{{ scope.row.remark.substr(0,20)+'...' }}</span>
96
+              <span slot="reference" v-else>{{ scope.row.remark}}</span>
97
+            </el-popover>
98
+
99
+          </template>
100
+        </el-table-column>
101
+      </el-table>
102
+    </el-row>
103
+  </div>
104
+</template>
105
+
106
+<script>
107
+  import { uParseTime } from '@/utils/tools'
108
+  import { GetAllConfig, getWarehouseInfoList, deleteWarehouseInfo } from '@/api/stock'
109
+
110
+  export default {
111
+    name: 'otherStockInOrderDetail',
112
+    created() {
113
+      const order_id = this.$route.query.id
114
+      this.GetConfigInfo()
115
+      this.GetOrderDetail(order_id)
116
+    },
117
+    data() {
118
+      return {
119
+        isEdit: 0,
120
+        checked: false,
121
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
122
+        goodType: [],
123
+        goodInfo: [],
124
+        manufacturer: [],
125
+        dealer: [],
126
+        Warehouse: {
127
+          loading: false,
128
+          warehouseDate: [],
129
+          tableCurrentIndex: ''
130
+        },
131
+
132
+        WarehouseInfo: {
133
+          loading: false,
134
+          warehouseInfoDate: [],
135
+          warehouse: {}
136
+        }
137
+      }
138
+    },
139
+    methods: {
140
+      getSpecificationName: function(id) {
141
+        let name = ''
142
+        for (let i = 0; i < this.goodInfo.length; i++) {
143
+          if (this.goodInfo[i].id == id) {
144
+            name = this.goodInfo[i].specification_name
145
+          }
146
+        }
147
+        return name
148
+      }, getTypeName: function(id) {
149
+        let name = ''
150
+        for (let i = 0; i < this.goodType.length; i++) {
151
+          if (this.goodType[i].id == id) {
152
+            name = this.goodType[i].type_name
153
+          }
154
+        }
155
+        return name
156
+      }, GetConfigInfo: function() {
157
+        GetAllConfig().then(response => {
158
+          if (response.data.state == 0) {
159
+            this.$message.error(response.data.msg)
160
+            return false
161
+          } else {
162
+            this.manufacturer = response.data.data.manufacturer
163
+            this.dealer = response.data.data.dealer
164
+            this.goodInfo = response.data.data.goodInfo
165
+            this.goodType = response.data.data.goodType
166
+          }
167
+        })
168
+      }, getManufactuerName: function(manufacturer_id) {
169
+        for (let i = 0; i < this.manufacturer.length; i++) {
170
+          if (this.manufacturer[i].id == manufacturer_id) {
171
+            return this.manufacturer[i].manufacturer_name
172
+          }
173
+        }
174
+      }, getDealerName: function(dealer_id) {
175
+        for (let i = 0; i < this.dealer.length; i++) {
176
+          if (this.dealer[i].id == dealer_id) {
177
+            return this.dealer[i].dealer_name
178
+          }
179
+        }
180
+      }, calculate: function(val) {
181
+        if (val == 0) {
182
+          return ''
183
+        }
184
+        return Math.round(parseFloat(val) * 100) / 100
185
+      }, GetOrderDetail: function(order_id) {
186
+        const params = {
187
+          'id': order_id
188
+        }
189
+        getWarehouseInfoList(params).then(response => {
190
+          if (response.data.state == 0) {
191
+            this.$message.error(response.data.msg)
192
+            return false
193
+          } else {
194
+            for (let i = 0; i < response.data.data.info.length; i++) {
195
+              this.WarehouseInfo.warehouseInfoDate.push(response.data.data.info[i])
196
+            }
197
+            this.WarehouseInfo.warehouse = response.data.data.warehousing
198
+          }
199
+        })
200
+      }, deleteRecord: function() {
201
+        const ids = []
202
+        ids.push(this.WarehouseInfo.warehouse.id)
203
+        const idStr = ids.join(',')
204
+
205
+        const params = {
206
+          ids: idStr
207
+        }
208
+
209
+        this.$confirm('确认删除入库单记录?', '删除入库单记录', {
210
+          confirmButtonText: '确定',
211
+          cancelButtonText: '取消',
212
+          type: 'warning'
213
+        }).then(() => {
214
+          deleteWarehouseInfo(params).then(response => {
215
+            if (response.data.state == 0) {
216
+              this.$message.error(response.data.msg)
217
+              return false
218
+            } else {
219
+              this.$notify({
220
+                title: '成功',
221
+                message: '删除成功',
222
+                type: 'success',
223
+                duration: 2000
224
+              })
225
+
226
+              this.$router.back(-1)
227
+            }
228
+          })
229
+        }).catch(() => {
230
+        })
231
+      }, editRecord: function() {
232
+        this.$emit('edit-record')
233
+      }
234
+    }
235
+  }
236
+</script>
237
+
238
+<style rel="stylesheet/css" lang="scss" scoped>
239
+  .information {
240
+    border: 1px #dcdfe6 solid;
241
+    padding: 30px 20px 30px 20px;
242
+
243
+  .border {
244
+    border-bottom: 1px #dcdfe6 solid;
245
+    margin: 0px 0 20px 0;
246
+  }
247
+
248
+  }
249
+
250
+  .title {
251
+    background: #409eff;
252
+    height: 44px;
253
+    line-height: 44px;
254
+    padding: 0 0 0 10px;
255
+    color: #fff;
256
+    margin: 0 0 10px 0;
257
+  }
258
+
259
+  .edit_separater {
260
+    border-top: 1px solid rgb(233, 233, 233);
261
+    margin-top: 15px;
262
+    margin-bottom: 15px;
263
+  }
264
+
265
+</style>
266
+
267
+<style>
268
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
269
+    font-size: 12px;
270
+  }
271
+
272
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
273
+    background: #6fb5fa;
274
+  }
275
+
276
+  .count {
277
+    color: #bd2c00;
278
+
279
+  }
280
+
281
+</style>

+ 502 - 0
src/xt_pages/stock/otherStockInOrderEdit.vue Целия файл

@@ -0,0 +1,502 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <sales-return-dialog :propForm="propForm"
6
+                         :visibility="isVisibility"
7
+                         v-on:dialog-comfirm="comfirm"
8
+                         v-on:dialog-cancle="cancle"></sales-return-dialog>
9
+
10
+    <div class="filter-container">
11
+
12
+      <el-row>
13
+        <el-col :span="8"><div>
14
+          <span>入库时间:</span>
15
+          <el-date-picker v-model="warehousing_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
16
+                          type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
17
+                          value-format="yyyy-MM-dd"></el-date-picker>
18
+        </div></el-col>
19
+      </el-row>
20
+    </div>
21
+
22
+    <el-row>
23
+      <el-col>
24
+        <el-form  :rules="tableRules" :model="recordInfo" ref="tableForm">
25
+          <el-table :data="recordInfo.recordData" :class="signAndWeighBoxPatients" style="width: 100%" border
26
+                    max-height="450"
27
+          >
28
+
29
+            <el-table-column label="操作" align="center" min-width="30">
30
+              <template slot-scope="scope">
31
+                <el-button
32
+                  size="mini"
33
+                  @click="handleEdit(scope.$index, scope.row)">+
34
+                </el-button>
35
+                <el-button
36
+                  size="mini"
37
+                  type="danger"
38
+                  @click="handleDelete(scope.$index, scope.row)">-
39
+                </el-button>
40
+              </template>
41
+            </el-table-column>
42
+
43
+            <el-table-column min-width="35" align="center">
44
+
45
+              <template slot="header" slot-scope="scope">
46
+                <span>物品类型<span style="color: red">*</span></span>
47
+              </template>
48
+
49
+              <template slot-scope="scope" >
50
+                <!--<span @click="showDialog(scope.$index, scope.row)" v-if="scope.row.good_type_id == 0" style="color:#c5c8cf">请输入类型</span>-->
51
+                <!--<span @click="showDialog(scope.$index, scope.row)" v-if="scope.row.good_type_id != 0">{{typeName(scope.row.good_type_id)}}</span>-->
52
+
53
+                <el-form-item  style="padding-top: 15px">
54
+                  <el-input placeholder="请输入物品类型"  v-model="scope.row.good_type_id" :value="typeName(scope.row.good_type_id)" @focus="showDialog(scope.$index, scope.row)" ></el-input>
55
+                </el-form-item>
56
+
57
+              </template>
58
+            </el-table-column>
59
+            <el-table-column min-width="35" align="center">
60
+              <template slot="header" slot-scope="scope">
61
+                <span>规格名称<span style="color: red">*</span></span>
62
+              </template>
63
+              <template slot-scope="scope">
64
+
65
+                <el-form-item  style="padding-top: 15px">
66
+                  <el-input placeholder="请输入规格名称"  v-model="scope.row.good_id" :value="specificationName(scope.row.good_id)" @focus="showDialog(scope.$index, scope.row)" ></el-input>
67
+                </el-form-item>
68
+
69
+              </template>
70
+            </el-table-column>
71
+
72
+
73
+            <el-table-column  min-width="23" align="center">
74
+              <template slot="header" slot-scope="scope">
75
+                <span>单价<span style="color: red">*</span></span>
76
+              </template>
77
+              <template slot-scope="scope">
78
+                <!--<el-input type="number" v-model="scope.row.price"  @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
79
+                <el-form-item :prop="'recordData.' + scope.$index + '.price'" :rules='tableRules.price' style="padding-top: 17px">
80
+                  <el-input type="number"  v-model="scope.row.price" ></el-input>
81
+                </el-form-item>
82
+
83
+
84
+
85
+
86
+              </template>
87
+            </el-table-column>
88
+
89
+            <el-table-column  min-width="23" align="center">
90
+              <template slot="header" slot-scope="scope">
91
+                <span>入库数量<span style="color: red">*</span></span>
92
+              </template>
93
+              <template slot-scope="scope">
94
+                <!--{{scope.row.warehousing_count}}-->
95
+                <!--<el-input type="number" v-model="scope.row.warehousing_count"   @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
96
+
97
+                <el-form-item :prop="'recordData.' + scope.$index + '.warehousing_count'" :rules='tableRules.warehousing_count' style="padding-top: 17px">
98
+                  <el-input type="number"  v-model="scope.row.warehousing_count" ></el-input>
99
+                </el-form-item>
100
+              </template>
101
+            </el-table-column>
102
+
103
+            <el-table-column label="总价" min-width="20" align="center">
104
+              <template slot-scope="scope">
105
+                {{calculate(scope.row.price*scope.row.warehousing_count)}}
106
+              </template>
107
+            </el-table-column>
108
+
109
+            <el-table-column  align="center" min-width="25">
110
+              <template slot="header" slot-scope="scope">
111
+                <span>批号<span style="color: red">*</span></span>
112
+              </template>
113
+              <template slot-scope="scope">
114
+                <!--<el-input  v-model="scope.row.numbers"></el-input>-->
115
+
116
+                <el-form-item :prop="'recordData.' + scope.$index + '.number'" :rules='tableRules.number' style="padding-top: 17px">
117
+                  <el-input  v-model="scope.row.number" ></el-input>
118
+                </el-form-item>
119
+
120
+              </template>
121
+            </el-table-column>
122
+            <el-table-column label="生产日期" min-width="40" align="center">
123
+              <template slot-scope="scope" >
124
+                <!--{{scope.row.product_date | parseTime("{y}-{m}-{d}")}}-->
125
+                <el-date-picker prefix-icon="el-icon-date" style="width: 145px" v-model="scope.row.product_date"
126
+                                type="date" placeholder="选择日期时间" format="yyyy-MM-dd"
127
+                                value-format="yyyy-MM-dd"></el-date-picker>
128
+
129
+              </template>
130
+            </el-table-column>
131
+            <el-table-column label="有效日期" min-width="40" align="center">
132
+              <template slot-scope="scope">
133
+                <!--{{ scope.row.expiry_date | parseTime("{y}-{m}-{d}")}}-->
134
+                <el-date-picker  prefix-icon="el-icon-date" style="width: 145px" v-model="scope.row.expiry_date"
135
+                                 type="date" placeholder="选择日期时间"  format="yyyy-MM-dd"
136
+                                 value-format="yyyy-MM-dd"></el-date-picker>
137
+
138
+              </template>
139
+            </el-table-column>
140
+            <el-table-column label="备注" min-width="20" align="center">
141
+              <template slot-scope="scope">
142
+                <el-input  v-model="scope.row.remark"></el-input>
143
+              </template>
144
+            </el-table-column>
145
+          </el-table>
146
+        </el-form>
147
+      </el-col>
148
+
149
+
150
+      <span  class="dialog-footer" style="margin-top: 20px;float:right">
151
+        <el-button @click="back()">取 消</el-button>
152
+        <el-button type="primary" @click="submit()">确 定</el-button>
153
+      </span>
154
+
155
+    </el-row>
156
+  </div>
157
+</template>
158
+
159
+<script>
160
+  import stockInDialog from './Dialog/stockInDialog'
161
+  import { uParseTime } from '@/utils/tools'
162
+
163
+  import {
164
+    GetAllConfig,
165
+    getWarehouseInfoList,
166
+    GetAllGoodInfoByID,
167
+    getWarehouseInfoByOrdeNumber,
168
+    modifyWarehouseInfo,
169
+    deleteWarehouseInfo,
170
+    DeleteWarehouseInfoItem,
171
+    EditWarehouse
172
+  } from '@/api/stock'
173
+  import SalesReturnDialog from './Dialog/salesReturnDialog'
174
+
175
+  export default {
176
+    components: { SalesReturnDialog, stockInDialog },
177
+    name: 'stockInOrderEdit',
178
+
179
+    data() {
180
+      var checkGoodId = (rule, value, callback) => {
181
+        setTimeout(() => {
182
+          if (value == '' || value == 0) {
183
+            return callback(new Error('规格名称不能为空'))
184
+          }
185
+        }, 2000)
186
+      }
187
+
188
+      return {
189
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
190
+        warehousing_time: '',
191
+        adminUserOptions: null,
192
+        currentIndex: 0,
193
+
194
+        recordInfo: {
195
+          recordData: [],
196
+          stock_in_code: '',
197
+          current_index: ''
198
+
199
+        },
200
+        tableRules: {
201
+          price: [
202
+            { required: true, message: '单价不能为空', trigger: 'blur' }
203
+          ],
204
+          warehousing_count: [
205
+            { required: true, message: '数量不能为空', trigge: 'blur' }
206
+          ],
207
+          number: [
208
+            { required: true, message: '批号不能为空', trigge: 'blur' }
209
+          ],
210
+          good_id: [
211
+            { validator: checkGoodId, trigger: 'blur' }
212
+          ]
213
+
214
+        },
215
+        ruleForm: {
216
+          manufacturer: [
217
+            { required: true, message: '请选择厂商', trigger: 'change' }
218
+          ]
219
+
220
+        },
221
+
222
+        total: '',
223
+        product_date: '',
224
+        expiry_date: '',
225
+        numbers: '',
226
+        // prop
227
+        isVisibility: false,
228
+        propForm: {
229
+          goodType: [],
230
+          goodInfo: [],
231
+          goodUnit: [],
232
+          title: '入库',
233
+          isCreated: 1
234
+
235
+        },
236
+
237
+        form: {
238
+          manufacturer: '',
239
+          dealer: ''
240
+        },
241
+        warehouse: {},
242
+        manufacturer: [],
243
+        dealer: [],
244
+        goodType: []
245
+      }
246
+    },
247
+    methods: {
248
+      comfirm: function(val) {
249
+        this.isVisibility = false
250
+        if (val.selectedGoodInfo.length > 0) {
251
+          for (let i = val.selectedGoodInfo.length - 1; ;i--) {
252
+            if (i == 0) {
253
+              this.recordInfo.recordData[this.currentIndex].good_type_id = val.goodTypeId
254
+              this.recordInfo.recordData[this.currentIndex].good_id = val.selectedGoodInfo[i].id
255
+            } else {
256
+              const tempForm = {}
257
+              tempForm['id'] = 0
258
+              tempForm['good_type_id'] = val.goodTypeId
259
+              tempForm['good_id'] = val.selectedGoodInfo[i].id
260
+              tempForm['number'] = ''
261
+              tempForm['product_date'] = ''
262
+              tempForm['expiry_date'] = ''
263
+              tempForm['warehousing_count'] = ''
264
+              tempForm['price'] = ''
265
+              tempForm['remark'] = ''
266
+              tempForm['dealer'] = ''
267
+              tempForm['manufacturer'] = ''
268
+              this.recordInfo.recordData.push(tempForm)
269
+            }
270
+          }
271
+        }
272
+
273
+        this.currentIndex = -1
274
+      }, cancle: function() {
275
+        this.isVisibility = false
276
+      },  GetConfigInfo: function() {
277
+        GetAllConfig().then(response => {
278
+          if (response.data.state == 0) {
279
+            this.$message.error(response.data.msg)
280
+            return false
281
+          } else {
282
+            this.manufacturer = response.data.data.manufacturer
283
+            this.dealer = response.data.data.dealer
284
+            this.goodType = response.data.data.goodType
285
+            this.goodInfo = response.data.data.goodInfo
286
+          }
287
+        })
288
+
289
+      }, typeName: function(good_type_id) {
290
+        let name = '请输入物品类型'
291
+        for (let i = 0; i < this.goodType.length; i++) {
292
+          if (this.goodType[i].id == good_type_id) {
293
+            name = this.goodType[i].type_name
294
+          }
295
+        }
296
+        return name
297
+      }, specificationName: function(good_info_id) {
298
+        let name = ''
299
+        for (let i = 0; i < this.goodInfo.length; i++) {
300
+          if (this.goodInfo[i].id == good_info_id) {
301
+            name = this.goodInfo[i].specification_name
302
+          }
303
+        }
304
+        return name
305
+      }, handleEdit: function(index, row) {
306
+        const tempObj = {}
307
+        tempObj['id'] = 0
308
+        tempObj['good_type_id'] = 0
309
+        tempObj['good_id'] = 0
310
+        tempObj['number'] = ''
311
+        tempObj['product_date'] = ''
312
+        tempObj['expiry_date'] = ''
313
+        tempObj['warehousing_count'] = ''
314
+        tempObj['price'] = ''
315
+        tempObj['remark'] = ''
316
+        tempObj['dealer'] = ''
317
+        tempObj['manufacturer'] = ''
318
+        this.recordInfo.recordData.push(tempObj)
319
+      }, handleDelete: function(index, row) {
320
+        if (row.id == 0) {
321
+          this.recordInfo.recordData.splice(index, 1)
322
+        } else {
323
+          const params = {
324
+            id: row.id
325
+          }
326
+          this.$confirm('确认删除该入库物品信息记录?', '删除入库物品信息记录', {
327
+            confirmButtonText: '确定',
328
+            cancelButtonText: '取消',
329
+            type: 'warning'
330
+          }).then(() => {
331
+            DeleteWarehouseInfoItem(params).then(response => {
332
+              if (response.data.state == 0) {
333
+                this.$message.error(response.data.msg)
334
+                return false
335
+              } else {
336
+                this.$notify({
337
+                  title: '成功',
338
+                  message: '删除成功',
339
+                  type: 'success',
340
+                  duration: 2000
341
+                })
342
+                this.recordInfo.recordData.splice(index, 1)
343
+              }
344
+            })
345
+          }).catch(() => {
346
+          })
347
+        }
348
+      }, calculate: function(val) {
349
+        if (val == 0) {
350
+          return ''
351
+        }
352
+        return Math.round(parseFloat(val) * 100) / 100
353
+      },  getTime(val, temp) {
354
+        if (val != 0) {
355
+          return uParseTime(val, temp)
356
+        } else {
357
+          return ''
358
+        }
359
+      }, showDialog(index, row) {
360
+        this.currentIndex = index
361
+        if (this.form.manufacturer == '' || this.form.manufacturer == 0) {
362
+          this.$message.error('请先选择厂商')
363
+          return
364
+        } else {
365
+          this.isVisibility = true
366
+          const params = {
367
+            id: this.form.manufacturer
368
+          }
369
+          GetAllGoodInfoByID(params).then(response => {
370
+            if (response.data.state == 0) {
371
+              this.$message.error(response.data.msg)
372
+              return false
373
+            } else {
374
+              if (response.data.data.goodInfo.length == 0) {
375
+                this.$message.error('该厂商没商品,请添加商品')
376
+              } else {
377
+                for (let i = 0; i < response.data.data.goodInfo.length; i++) {
378
+                  this.propForm.goodType.push(response.data.data.goodInfo[i].GoodsType)
379
+                }
380
+
381
+                const obj = {}
382
+                this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
383
+                  obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
384
+                  return cur
385
+                }, []) // 设置cur默认类型为数组,并且初始值为空的数组
386
+              }
387
+            }
388
+          })
389
+        }
390
+      }, back() {
391
+        this.$router.go(-1)
392
+      }, submit() {
393
+        this.$refs['tableForm'].validate((valid) => {
394
+          if (valid) {
395
+            const array = this.recordInfo.recordData
396
+            for (let i = 0; i < array.length; i++) {
397
+              if (array[i].good_type_id == 0) {
398
+                this.$message.error('物品类型不能为空')
399
+                return
400
+              }
401
+              if (array[i].good_id == 0) {
402
+                this.$message.error('规格名称不能为空')
403
+                return
404
+              }
405
+            }
406
+
407
+            const params = {
408
+              'stockIn': this.recordInfo.recordData
409
+            }
410
+            EditWarehouse(params, this.warehousing_time, this.$route.query.id).then(response => {
411
+              if (response.data.state == 0) {
412
+                this.$message.error(response.data.msg)
413
+                return false
414
+              } else {
415
+                this.$notify({
416
+                  title: '成功',
417
+                  message: '入库成功',
418
+                  type: 'success',
419
+                  duration: 2000
420
+                })
421
+                this.$router.back(-1)
422
+              }
423
+            })
424
+          } else {
425
+            return false
426
+          }
427
+        })
428
+      }, GetOrderDetail: function(order_id) {
429
+        const params = {
430
+          'id': order_id
431
+        }
432
+        getWarehouseInfoList(params).then(response => {
433
+          if (response.data.state == 0) {
434
+            this.$message.error(response.data.msg)
435
+            return false
436
+          } else {
437
+            for (let i = 0; i < response.data.data.info.length; i++) {
438
+              response.data.data.info[i].product_date = this.getTime(response.data.data.info[i].product_date, '{y}-{m}-{d}')
439
+              response.data.data.info[i].expiry_date = this.getTime(response.data.data.info[i].expiry_date, '{y}-{m}-{d}')
440
+              response.data.data.info[i].price = response.data.data.info[i].price.toString()
441
+              response.data.data.info[i].warehousing_count = response.data.data.info[i].warehousing_count.toString()
442
+
443
+              this.recordInfo.recordData.push(response.data.data.info[i])
444
+            }
445
+
446
+            this.warehouse = response.data.data.warehousing
447
+            this.form.manufacturer = this.warehouse.manufacturer
448
+            this.form.dealer = this.warehouse.dealer
449
+            this.warehousing_time = this.getTime(this.warehouse.warehousing_time, '{y}-{m}-{d}')
450
+          }
451
+        })
452
+      }
453
+    },
454
+    created() {
455
+      this.GetConfigInfo()
456
+      this.propForm.goodUnit = this.$store.getters.good_unit
457
+      const order_id = this.$route.query.id
458
+      this.GetOrderDetail(order_id)
459
+    }
460
+
461
+  }
462
+</script>
463
+
464
+<style rel="stylesheet/css" lang="scss" scoped>
465
+  .information {
466
+    border: 1px #dcdfe6 solid;
467
+    padding: 30px 20px 30px 20px;
468
+
469
+  .border {
470
+    border-bottom: 1px #dcdfe6 solid;
471
+    margin: 0px 0 20px 0;
472
+  }
473
+  }
474
+
475
+  .title {
476
+    background: #409eff;
477
+    height: 44px;
478
+    line-height: 44px;
479
+    padding: 0 0 0 10px;
480
+    color: #fff;
481
+    margin: 0 0 10px 0;
482
+    border-radius: 4px 4px 0 0;
483
+  }
484
+
485
+  .edit_separater {
486
+    border-top: 1px solid rgb(233, 233, 233);
487
+    margin-top: 15px;
488
+    margin-bottom: 15px;
489
+  }
490
+
491
+</style>
492
+
493
+<style>
494
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
495
+    font-size: 12px;
496
+  }
497
+
498
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
499
+    background: #6fb5fa;
500
+  }
501
+
502
+</style>

+ 13 - 0
src/xt_pages/stock/otherStockOutDetail.vue Целия файл

@@ -0,0 +1,13 @@
1
+<template>
2
+
3
+</template>
4
+
5
+<script>
6
+  export default {
7
+    name: 'otherStockOutDetail'
8
+  }
9
+</script>
10
+
11
+<style scoped>
12
+
13
+</style>

+ 13 - 0
src/xt_pages/stock/otherStockOutOrder.vue Целия файл

@@ -0,0 +1,13 @@
1
+<template>
2
+
3
+</template>
4
+
5
+<script>
6
+  export default {
7
+    name: 'otherStockOutOrder'
8
+  }
9
+</script>
10
+
11
+<style scoped>
12
+
13
+</style>

+ 13 - 0
src/xt_pages/stock/otherStockOutOrderAdd.vue Целия файл

@@ -0,0 +1,13 @@
1
+<template>
2
+
3
+</template>
4
+
5
+<script>
6
+  export default {
7
+    name: 'otherStockOutOrderAdd'
8
+  }
9
+</script>
10
+
11
+<style scoped>
12
+
13
+</style>

+ 13 - 0
src/xt_pages/stock/otherStockOutOrderDetail.vue Целия файл

@@ -0,0 +1,13 @@
1
+<template>
2
+
3
+</template>
4
+
5
+<script>
6
+  export default {
7
+    name: 'otherStockOutOrderDetail'
8
+  }
9
+</script>
10
+
11
+<style scoped>
12
+
13
+</style>

+ 13 - 0
src/xt_pages/stock/otherStockOutOrderEdit.vue Целия файл

@@ -0,0 +1,13 @@
1
+<template>
2
+
3
+</template>
4
+
5
+<script>
6
+  export default {
7
+    name: 'otherStockOutOrderEdit'
8
+  }
9
+</script>
10
+
11
+<style scoped>
12
+
13
+</style>

+ 24 - 0
src/xt_pages/stock/salesReturnDetail.vue Целия файл

@@ -0,0 +1,24 @@
1
+<template>
2
+  <sales-return-order-detail v-if="isEdit == 0"   v-on:edit-record="isEdit = 1"></sales-return-order-detail>
3
+  <sales-return-edit v-else></sales-return-edit>
4
+</template>
5
+
6
+<script>
7
+  import SalesReturnEdit from './salesReturnEdit'
8
+  import SalesReturnOrderDetail from './salesReturnOrderDetail'
9
+  export default {
10
+    name: 'stockInDeatail',
11
+    components: { SalesReturnOrderDetail, SalesReturnEdit },
12
+    data() {
13
+      return {
14
+        isEdit: 0
15
+      }
16
+    }
17
+
18
+  }
19
+
20
+</script>
21
+
22
+<style scoped>
23
+
24
+</style>

+ 391 - 0
src/xt_pages/stock/salesReturnEdit.vue Целия файл

@@ -0,0 +1,391 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <sales-return-dialog :propForm="propForm"
6
+                     :visibility="isVisibility"
7
+                     v-on:dialog-comfirm="comfirm"
8
+                     v-on:dialog-cancle="cancle"></sales-return-dialog>
9
+
10
+    <div class="filter-container">
11
+
12
+      <el-row>
13
+        <el-col :span="8">
14
+          <div>
15
+            <span>入库时间:</span>
16
+            <el-date-picker v-model="return_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
17
+                            type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
18
+                            value-format="yyyy-MM-dd"></el-date-picker>
19
+          </div>
20
+        </el-col>
21
+      </el-row>
22
+    </div>
23
+
24
+    <el-row>
25
+      <el-col>
26
+        <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
27
+          <el-table :data="recordInfo.recordData" :class="signAndWeighBoxPatients" style="width: 100%" border
28
+                    max-height="450"
29
+          >
30
+
31
+            <el-table-column label="操作" align="center" min-width="30">
32
+              <template slot-scope="scope">
33
+                <el-button
34
+                  size="mini"
35
+                  @click="handleEdit(scope.$index, scope.row)">+
36
+                </el-button>
37
+                <el-button
38
+                  size="mini"
39
+                  type="danger"
40
+                  @click="handleDelete(scope.$index, scope.row)">-
41
+                </el-button>
42
+              </template>
43
+            </el-table-column>
44
+
45
+            <el-table-column min-width="35" align="center">
46
+
47
+              <template slot="header" slot-scope="scope">
48
+                <span>物品类型<span style="color: red">*</span></span>
49
+              </template>
50
+
51
+              <template slot-scope="scope">
52
+                <el-form-item style="padding-top: 15px">
53
+                  <el-input placeholder="请输入物品类型" v-model="scope.row.good_type_id"
54
+                            :value="typeName(scope.row.good_type_id)"
55
+                            @focus="showDialog(scope.$index, scope.row)"></el-input>
56
+                </el-form-item>
57
+              </template>
58
+            </el-table-column>
59
+            <el-table-column min-width="35" align="center">
60
+              <template slot="header" slot-scope="scope">
61
+                <span>规格名称<span style="color: red">*</span></span>
62
+              </template>
63
+              <template slot-scope="scope">
64
+
65
+                <el-form-item style="padding-top: 15px">
66
+                  <el-input placeholder="请输入规格名称" v-model="scope.row.good_id"
67
+                            :value="specificationName(scope.row.good_id)"
68
+                            @focus="showDialog(scope.$index, scope.row)"></el-input>
69
+                </el-form-item>
70
+
71
+              </template>
72
+            </el-table-column>
73
+
74
+
75
+            <el-table-column min-width="23" align="center">
76
+              <template slot="header" slot-scope="scope">
77
+                <span>退货数量<span style="color: red">*</span></span>
78
+              </template>
79
+              <template slot-scope="scope">
80
+                <el-form-item :prop="'recordData.' + scope.$index + '.count'" :rules='tableRules.count'
81
+                              style="padding-top: 17px">
82
+                  <el-input type="number" v-model="scope.row.count"></el-input>
83
+                </el-form-item>
84
+              </template>
85
+            </el-table-column>
86
+
87
+
88
+          </el-table>
89
+        </el-form>
90
+      </el-col>
91
+
92
+
93
+      <span class="dialog-footer" style="margin-top: 20px;float:right">
94
+        <el-button @click="back()">取 消</el-button>
95
+        <el-button type="primary" @click="submit()">确 定</el-button>
96
+      </span>
97
+
98
+    </el-row>
99
+  </div>
100
+</template>
101
+
102
+<script>
103
+  import { uParseTime } from '@/utils/tools'
104
+
105
+  import {
106
+    deleteSalesReturnInfo,
107
+    getReturnList,
108
+    getSalesReturnConfig,
109
+    editSalesReturnInfo
110
+  } from '@/api/stock'
111
+  import SalesReturnDialog from './Dialog/salesReturnDialog'
112
+
113
+  export default {
114
+    components: { SalesReturnDialog },
115
+    name: 'salesReturnEdit',
116
+
117
+    data() {
118
+      return {
119
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
120
+        warehousing_time: '',
121
+        adminUserOptions: null,
122
+        currentIndex: 0,
123
+        return_time: '',
124
+        recordInfo: {
125
+          recordData: [],
126
+          stock_in_code: '',
127
+          current_index: ''
128
+
129
+        },
130
+        tableRules: {
131
+          count: [
132
+            { required: true, message: '数量不能为空', trigge: 'blur' }
133
+          ]
134
+
135
+        },
136
+        ruleForm: {
137
+          manufacturer: [
138
+            { required: true, message: '请选择厂商', trigger: 'change' }
139
+          ]
140
+
141
+        },
142
+
143
+        // prop
144
+        isVisibility: false,
145
+        propForm: {
146
+          goodType: [],
147
+          goodInfo: [],
148
+          goodUnit: [],
149
+          title: '入库'
150
+        },
151
+
152
+        form: {
153
+          manufacturer: '',
154
+          dealer: ''
155
+        },
156
+
157
+        salesReturn: {},
158
+        manufacturer: [],
159
+        dealer: [],
160
+        goodType: []
161
+      }
162
+    },
163
+    methods: {
164
+       comfirm: function(val) {
165
+        this.isVisibility = false
166
+        if (val.selectedGoodInfo.length > 0) {
167
+          for (let i = val.selectedGoodInfo.length - 1; ; i--) {
168
+            if (i == 0) {
169
+              this.recordInfo.recordData[this.currentIndex].good_type_id = val.goodTypeId
170
+              this.recordInfo.recordData[this.currentIndex].good_id = val.selectedGoodInfo[i].id
171
+            } else {
172
+              const tempForm = {}
173
+              tempForm['id'] = 0
174
+              tempForm['good_type_id'] = val.goodTypeId
175
+              tempForm['good_id'] = val.selectedGoodInfo[i].id
176
+              tempForm['count'] = ''
177
+              this.recordInfo.recordData.push(tempForm)
178
+            }
179
+          }
180
+        }
181
+
182
+        this.currentIndex = -1
183
+      }, cancle: function() {
184
+        this.isVisibility = false
185
+      }, GetConfigInfo: function() {
186
+        getSalesReturnConfig().then(response => {
187
+          if (response.data.state == 0) {
188
+            this.$message.error(response.data.msg)
189
+            return false
190
+          } else {
191
+            var warehouseInfoList = response.data.data.warehouseInfoList
192
+            for (let i = 0; i < warehouseInfoList.length; i++) {
193
+              this.propForm.goodInfo.push(warehouseInfoList[i].GoodInfo)
194
+              this.propForm.goodType.push(warehouseInfoList[i].GoodInfo.GoodsType)
195
+
196
+            }
197
+            const obj3 = {}
198
+            const obj4 = {}
199
+            this.propForm.goodInfo = this.propForm.goodInfo.reduce((cur, next) => {
200
+              obj4[next.id] ? '' : obj4[next.id] = true && cur.push(next)
201
+              return cur
202
+            }, [])
203
+            this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
204
+              obj3[next.id] ? '' : obj3[next.id] = true && cur.push(next)
205
+              return cur
206
+            }, [])
207
+          }
208
+        })
209
+      }, typeName: function(good_type_id) {
210
+        let name = ''
211
+        for (let i = 0; i < this.propForm.goodType.length; i++) {
212
+          if (this.propForm.goodType[i].id == good_type_id) {
213
+            name = this.propForm.goodType[i].type_name
214
+          }
215
+        }
216
+        return name
217
+      }, specificationName: function(good_info_id) {
218
+        let name = ''
219
+        for (let i = 0; i < this.propForm.goodInfo.length; i++) {
220
+          if (this.propForm.goodInfo[i].id == good_info_id) {
221
+            name = this.propForm.goodInfo[i].specification_name
222
+          }
223
+        }
224
+        return name
225
+      }, handleEdit: function(index, row) {
226
+        const tempObj = {}
227
+        tempObj['id'] = 0
228
+        tempObj['good_type_id'] = 0
229
+        tempObj['good_id'] = 0
230
+        tempObj['count'] = ''
231
+        this.recordInfo.recordData.push(tempObj)
232
+      }, handleDelete: function(index, row) {
233
+        if (row.id == 0) {
234
+          this.recordInfo.recordData.splice(index, 1)
235
+        } else {
236
+          const params = {
237
+            id: row.id
238
+          }
239
+          this.$confirm('确认删除该退货物品信息记录?', '删除退货物品信息记录', {
240
+            confirmButtonText: '确定',
241
+            cancelButtonText: '取消',
242
+            type: 'warning'
243
+          }).then(() => {
244
+            deleteSalesReturnInfo(params).then(response => {
245
+              if (response.data.state == 0) {
246
+                this.$message.error(response.data.msg)
247
+                return false
248
+              } else {
249
+                this.$notify({
250
+                  title: '成功',
251
+                  message: '删除成功',
252
+                  type: 'success',
253
+                  duration: 2000
254
+                })
255
+                this.recordInfo.recordData.splice(index, 1)
256
+              }
257
+            })
258
+          }).catch(() => {
259
+          })
260
+        }
261
+      }, getTime(val, temp) {
262
+        if (val != 0) {
263
+          return uParseTime(val, temp)
264
+        } else {
265
+          return ''
266
+        }
267
+      }, showDialog(index, row) {
268
+        this.currentIndex = index
269
+
270
+        this.isVisibility = true
271
+        console.log(this.form.manufacturer)
272
+        for (let i = 0; i < this.propForm.goodInfo.length; i++) {
273
+          if (this.propForm.goodInfo[i].manufacturer == this.form.manufacturer) {
274
+            this.propForm.goodType.push(this.propForm.goodInfo[i].GoodsType)
275
+          }
276
+        }
277
+        const obj3 = {}
278
+        this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
279
+          obj3[next.id] ? '' : obj3[next.id] = true && cur.push(next)
280
+          return cur
281
+        }, [])
282
+
283
+      }, back() {
284
+        this.$router.go(-1)
285
+      }, submit() {
286
+        this.$refs['tableForm'].validate((valid) => {
287
+          if (valid) {
288
+            const array = this.recordInfo.recordData
289
+            for (let i = 0; i < array.length; i++) {
290
+              if (array[i].good_type_id == 0) {
291
+                this.$message.error('物品类型不能为空')
292
+                return
293
+              }
294
+              if (array[i].good_id == 0) {
295
+                this.$message.error('规格名称不能为空')
296
+                return
297
+              }
298
+            }
299
+
300
+            const params = {
301
+              'salesReturn': this.recordInfo.recordData
302
+            }
303
+            editSalesReturnInfo(params, this.return_time, this.$route.query.id).then(response => {
304
+              if (response.data.state == 0) {
305
+                this.$message.error(response.data.msg)
306
+                return false
307
+              } else {
308
+                this.$notify({
309
+                  title: '成功',
310
+                  message: '退货成功',
311
+                  type: 'success',
312
+                  duration: 2000
313
+                })
314
+                this.$router.back(-1)
315
+              }
316
+            })
317
+          } else {
318
+            return false
319
+          }
320
+        })
321
+      }, GetOrderDetail: function(order_id) {
322
+        const params = {
323
+          'id': order_id
324
+        }
325
+        getReturnList(params).then(response => {
326
+          if (response.data.state == 0) {
327
+            this.$message.error(response.data.msg)
328
+            return false
329
+          } else {
330
+            for (let i = 0; i < response.data.data.list.length; i++) {
331
+              this.recordInfo.list[i].count =  this.recordInfo.list[i].count.toString();
332
+              this.recordInfo.recordData.push(response.data.data.list[i])
333
+            }
334
+            this.salesReturn = response.data.data.salesReturn
335
+            this.return_time = this.getTime(this.salesReturn.return_time, '{y}-{m}-{d}')
336
+            this.form.manufacturer = this.salesReturn.manufacturer
337
+            this.form.dealer = this.salesReturn.dealer
338
+          }
339
+        })
340
+      }
341
+    },
342
+    created() {
343
+      this.GetConfigInfo()
344
+      this.propForm.goodUnit = this.$store.getters.good_unit
345
+      const order_id = this.$route.query.id
346
+      this.GetOrderDetail(order_id)
347
+    }
348
+
349
+  }
350
+</script>
351
+
352
+<style rel="stylesheet/css" lang="scss" scoped>
353
+  .information {
354
+    border: 1px #dcdfe6 solid;
355
+    padding: 30px 20px 30px 20px;
356
+
357
+  .border {
358
+    border-bottom: 1px #dcdfe6 solid;
359
+    margin: 0px 0 20px 0;
360
+  }
361
+
362
+  }
363
+
364
+  .title {
365
+    background: #409eff;
366
+    height: 44px;
367
+    line-height: 44px;
368
+    padding: 0 0 0 10px;
369
+    color: #fff;
370
+    margin: 0 0 10px 0;
371
+    border-radius: 4px 4px 0 0;
372
+  }
373
+
374
+  .edit_separater {
375
+    border-top: 1px solid rgb(233, 233, 233);
376
+    margin-top: 15px;
377
+    margin-bottom: 15px;
378
+  }
379
+
380
+</style>
381
+
382
+<style>
383
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
384
+    font-size: 12px;
385
+  }
386
+
387
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
388
+    background: #6fb5fa;
389
+  }
390
+
391
+</style>

+ 408 - 0
src/xt_pages/stock/salesReturnOrder.vue Целия файл

@@ -0,0 +1,408 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+
6
+    <div class="filter-container">
7
+
8
+
9
+      <el-row style="float:right;">
10
+        <el-button @click="AddNewOrder" type="primary">新增</el-button>
11
+      </el-row>
12
+    </div>
13
+
14
+    <div class="filter-container" style="margin-top:20px">
15
+      <el-input style="width: 300px;" class="filter-item" placeholder="单据日期/单据编码/制单人/供应商"/>
16
+      <el-button class="filter-item" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
17
+    </div>
18
+
19
+    <div class="filter-container">
20
+      <span>入库时间:</span>
21
+      <el-date-picker v-model="start_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
22
+                      type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
23
+                      value-format="yyyy-MM-dd" @change="startTimeChange"></el-date-picker>
24
+      <span class="">-</span>
25
+      <el-date-picker v-model="end_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
26
+                      type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
27
+                      value-format="yyyy-MM-dd" @change="endTimeChange"></el-date-picker>
28
+    </div>
29
+
30
+    <div class="filter-container" style="margin-top: 10px">
31
+      <el-checkbox style="width: 30px" v-model="checked" @change="changeAllSelected">全选</el-checkbox>
32
+      <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
33
+
34
+    </div>
35
+
36
+    <el-row :gutter="12" style="margin-top: 10px">
37
+      <el-table
38
+        :data="saleReturnDate"
39
+        :class="signAndWeighBoxPatients"
40
+        style="width: 100%" border
41
+        highlight-current-row
42
+        ref="multipleTable"
43
+        @selection-change="select"
44
+
45
+      >
46
+        <el-table-column
47
+          type="selection"
48
+          width="55">
49
+        </el-table-column>
50
+
51
+        <el-table-column label="单据日期" align="center">
52
+          <template slot-scope="scope">
53
+            {{ scope.row.opera_time | parseTime('{y}-{m}-{d}')}}
54
+          </template>
55
+        </el-table-column>
56
+
57
+        <el-table-column label="单据编号" align="center">
58
+          <template slot-scope="scope">
59
+            {{scope.row.order_number}}
60
+          </template>
61
+        </el-table-column>
62
+
63
+        <el-table-column label="制单人" align="center">
64
+          <template slot-scope="scope">
65
+            {{getXuserName(scope.row.creater)}}
66
+          </template>
67
+        </el-table-column>
68
+
69
+
70
+        <el-table-column label="厂家" align="center">
71
+          <template slot-scope="scope">
72
+            {{getManufactuerName(scope.row.manufacturer)}}
73
+          </template>
74
+        </el-table-column>
75
+
76
+        <el-table-column label="经销商" align="center">
77
+          <template slot-scope="scope">
78
+            {{getDealerName(scope.row.dealer)}}
79
+          </template>
80
+        </el-table-column>
81
+
82
+        <el-table-column label="操作" align="center">
83
+          <template slot-scope="scope">
84
+            <el-button
85
+              size="mini"
86
+              type="primary"
87
+              icon="el-icon-edit"
88
+              @click="handleEdit(scope.$index, scope.row)">
89
+            </el-button>
90
+
91
+            <el-button
92
+              size="mini"
93
+              type="danger"
94
+              icon="el-icon-delete"
95
+              @click="handleDelete(scope.$index, scope.row)">
96
+            </el-button>
97
+
98
+          </template>
99
+        </el-table-column>
100
+
101
+      </el-table>
102
+
103
+      <el-pagination
104
+        @size-change="handleSizeChange"
105
+        @current-change="handleCurrentChange"
106
+        :page-sizes="[7]"
107
+        :page-size="7"
108
+        background
109
+        style="margin-top:20px;float: right"
110
+        layout="total, sizes, prev, pager, next, jumper"
111
+        :total="total">
112
+      </el-pagination>
113
+
114
+    </el-row>
115
+  </div>
116
+</template>
117
+
118
+<script>
119
+  import { uParseTime } from '@/utils/tools'
120
+  import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from '@/api/doctor'
121
+  import {
122
+    deleteSalesReturn,
123
+    GetAllConfig,
124
+    getWarehouseInfoList,
125
+    getSalesReturnList,
126
+    getWarehouseList
127
+  } from '@/api/stock'
128
+
129
+  export default {
130
+    name: 'salesReturnOrder',
131
+    created() {
132
+      var year = new Date().getFullYear()
133
+      var month = new Date().getMonth() + 1
134
+      var day = new Date().getDate()
135
+      if (parseInt(month) < 10) {
136
+        month = '0' + month
137
+      }
138
+      if (parseInt(day) < 10) {
139
+        day = '0' + day
140
+      }
141
+      const endTime = year + '-' + month + '-' + day
142
+      this.end_time = endTime
143
+
144
+      var year = new Date().getFullYear()
145
+      var month = new Date().getMonth()
146
+      var day = new Date().getDate()
147
+      if (parseInt(month) < 10) {
148
+        month = '0' + month
149
+      }
150
+      if (parseInt(day) < 10) {
151
+        day = '0' + day
152
+      }
153
+      const startTime = year + '-' + month + '-' + day
154
+      this.start_time = startTime
155
+      this.GetSalesReturn()
156
+      this.GetConfigInfo()
157
+      this.fetchAllAdminUsers()
158
+    },
159
+    data() {
160
+      return {
161
+        page: 1,
162
+        limit: 7,
163
+        checked: false,
164
+        total: 0,
165
+        pageTotal: 0,
166
+        pageSelect: 0,
167
+        adminUserOptions: [],
168
+        multipleSelection: [],
169
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
170
+        start_time: '',
171
+        saleReturnDate: [],
172
+        end_time: '',
173
+        goodType: [],
174
+        goodInfo: [],
175
+        manufacturer: [],
176
+        selectedTableData: [],
177
+        dealer: [],
178
+
179
+      }
180
+    },
181
+    methods: {
182
+      AddNewOrder:function(){
183
+        this.$router.push({ name: 'salesReturnOrderAdd'})
184
+      },
185
+      GetSalesReturn: function() {
186
+        const Params = {
187
+          page: this.page,
188
+          limit: this.limit,
189
+          start_time: this.start_time,
190
+          end_time: this.end_time
191
+        }
192
+        this.saleReturnDate = []
193
+        getSalesReturnList(Params).then(response => {
194
+          if (response.data.state == 0) {
195
+            this.$message.error(response.data.msg)
196
+            return false
197
+          } else {
198
+            this.total = response.data.data.total
199
+            for (let i = 0; i < response.data.data.list.length; i++) {
200
+              this.saleReturnDate.push(response.data.data.list[i])
201
+            }
202
+          }
203
+        })
204
+      }, getXuserName(id) {
205
+        if (id <= 0) {
206
+          return ''
207
+        }
208
+        var name = ''
209
+        if (this.adminUserOptions == null || typeof (this.adminUserOptions.length) === 'undefined') {
210
+          return name
211
+        }
212
+        var leng = this.adminUserOptions.length
213
+        if (leng == 0) {
214
+          return name
215
+        }
216
+        for (let index = 0; index < leng; index++) {
217
+          if (this.adminUserOptions[index].id == id) {
218
+            name = this.adminUserOptions[index].name
219
+            break
220
+          }
221
+        }
222
+        return name
223
+      }, fetchAllAdminUsers() {
224
+        fetchAllAdminUsers().then(response => {
225
+          console.log(response)
226
+          if (response.data.state == 1) {
227
+            this.adminUserOptions = response.data.data.users
228
+            var alen = this.adminUserOptions.length
229
+            for (let index = 0; index < alen; index++) {
230
+              if (this.adminUserOptions[index].user_type == 2) {
231
+                // this.doctorOptions.push(this.adminUserOptions[index]);
232
+              }
233
+            }
234
+          }
235
+        })
236
+      }, handleSelectionChange: function(val) {
237
+        this.multipleSelection = val
238
+      }, handleSizeChange(val) {
239
+        this.limit = val
240
+        this.GetWarehouse()
241
+      }, handleCurrentChange(val) {
242
+        this.page = val
243
+        this.GetWarehouse()
244
+      }, startTimeChange(val) {
245
+        this.GetWarehouse()
246
+      }, endTimeChange(val) {
247
+        this.GetWarehouse()
248
+      }, calculate: function(val) {
249
+        return Math.round(parseFloat(val) * 100) / 100
250
+      }, GetConfigInfo: function() {
251
+        GetAllConfig().then(response => {
252
+          if (response.data.state == 0) {
253
+            this.$message.error(response.data.msg)
254
+            return false
255
+          } else {
256
+            this.manufacturer = response.data.data.manufacturer
257
+            this.dealer = response.data.data.dealer
258
+          }
259
+        })
260
+      }, getManufactuerName: function(manufacturer_id) {
261
+        for (let i = 0; i < this.manufacturer.length; i++) {
262
+          if (this.manufacturer[i].id == manufacturer_id) {
263
+            return this.manufacturer[i].manufacturer_name
264
+          }
265
+        }
266
+      }, getDealerName: function(dealer_id) {
267
+        for (let i = 0; i < this.dealer.length; i++) {
268
+          if (this.dealer[i].id == dealer_id) {
269
+            return this.dealer[i].dealer_name
270
+          }
271
+        }
272
+      }, handleEdit: function(index, row) {
273
+        this.$router.push({ name: 'salesReturnDetail', query: { id: row.id }})
274
+      }, handleDelete: function(index, row) {
275
+        const ids = []
276
+        ids.push(row.id)
277
+        const idStr = ids.join(',')
278
+
279
+        const params = {
280
+          ids: idStr
281
+        }
282
+
283
+        this.$confirm('确认删除退货单记录?', '删除退货单记录', {
284
+          confirmButtonText: '确定',
285
+          cancelButtonText: '取消',
286
+          type: 'warning'
287
+        }).then(() => {
288
+          deleteSalesReturn(params).then(response => {
289
+            if (response.data.state == 0) {
290
+              this.$message.error(response.data.msg)
291
+              return false
292
+            } else {
293
+              this.$notify({
294
+                title: '成功',
295
+                message: '删除成功',
296
+                type: 'success',
297
+                duration: 2000
298
+              })
299
+              for (let i = 0; i < ids.length; i++) {
300
+                for (let y = 0; y < this.saleReturnDate.length; y++) {
301
+                  if (ids[i] == this.saleReturnDate[y].id) {
302
+                    this.saleReturnDate.splice(y, 1)
303
+                  }
304
+                }
305
+              }
306
+            }
307
+          })
308
+        }).catch(() => {
309
+        })
310
+      }, changeAllSelected: function(val) {
311
+        if (val) {
312
+          this.$refs.multipleTable.toggleAllSelection()
313
+        } else {
314
+          this.$refs.multipleTable.clearSelection()
315
+        }
316
+      }, select(selection) {
317
+        this.selectedTableData = selection
318
+      }, batchDelete() {
319
+        if (this.selectedTableData.length <= 0) {
320
+          this.$message.error('请选择要删除的记录')
321
+          return
322
+        }
323
+        const ids = []
324
+        for (let i = 0; i < this.selectedTableData.length; i++) {
325
+          ids.push(this.selectedTableData[i].id)
326
+        }
327
+        const idStr = ids.join(',')
328
+        const params = {
329
+          ids: idStr
330
+        }
331
+        this.$confirm('确认删除退货单记录?', '删除退货单记录', {
332
+          confirmButtonText: '确定',
333
+          cancelButtonText: '取消',
334
+          type: 'warning'
335
+        }).then(() => {
336
+          deleteSalesReturn(params).then(response => {
337
+            if (response.data.state == 0) {
338
+              this.$message.error(response.data.msg)
339
+              return false
340
+            } else {
341
+              this.$notify({
342
+                title: '成功',
343
+                message: '删除成功',
344
+                type: 'success',
345
+                duration: 2000
346
+              })
347
+
348
+              for (let i = 0; i < ids.length; i++) {
349
+                for (let y = 0; y < this.saleReturnDate.length; y++) {
350
+                  if (ids[i] == this.saleReturnDate[y].id) {
351
+                    this.saleReturnDate.splice(y, 1)
352
+                  }
353
+                }
354
+              }
355
+            }
356
+          })
357
+        }).catch(() => {
358
+        })
359
+      }
360
+    }
361
+  }
362
+</script>
363
+
364
+<style rel="stylesheet/css" lang="scss" scoped>
365
+  .information {
366
+    border: 1px #dcdfe6 solid;
367
+    padding: 30px 20px 30px 20px;
368
+
369
+  .border {
370
+    border-bottom: 1px #dcdfe6 solid;
371
+    margin: 0px 0 20px 0;
372
+  }
373
+
374
+  }
375
+
376
+  .title {
377
+    background: #409eff;
378
+    height: 44px;
379
+    line-height: 44px;
380
+    padding: 0 0 0 10px;
381
+    color: #fff;
382
+    margin: 0 0 10px 0;
383
+
384
+  }
385
+
386
+  .edit_separater {
387
+    border-top: 1px solid rgb(233, 233, 233);
388
+    margin-top: 15px;
389
+    margin-bottom: 15px;
390
+  }
391
+
392
+</style>
393
+
394
+<style>
395
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
396
+    font-size: 12px;
397
+  }
398
+
399
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
400
+    background: #6fb5fa;
401
+  }
402
+
403
+  .count {
404
+    color: #bd2c00;
405
+
406
+  }
407
+
408
+</style>

+ 413 - 0
src/xt_pages/stock/salesReturnOrderAdd.vue Целия файл

@@ -0,0 +1,413 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <sales-return-dialog :propForm="propForm"
6
+                     :visibility="isVisibility"
7
+                     v-on:dialog-comfirm="comfirm"
8
+                     v-on:dialog-cancle="cancle"></sales-return-dialog>
9
+
10
+    <div class="filter-container">
11
+
12
+      <el-row>
13
+        <el-col :span="8"><div>
14
+          <span>退货时间:</span>
15
+          <el-date-picker v-model="return_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
16
+                          type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
17
+                          value-format="yyyy-MM-dd"></el-date-picker>
18
+        </div></el-col>
19
+
20
+
21
+        <el-col :span="8">
22
+          <div>
23
+            <el-form ref="form" :model="form" :rules="ruleForm" label-width="80px">
24
+              <el-form-item label="厂商:" prop="manufacturer">
25
+                <el-select v-model="form.manufacturer" placeholder="请选择厂商">
26
+                  <el-option v-for="(option, index) in manufacturer" :key="index" :label="option.manufacturer_name" :value="option.id"></el-option>
27
+                </el-select>
28
+              </el-form-item>
29
+            </el-form>
30
+          </div>
31
+        </el-col>
32
+        <el-col :span="8">
33
+          <div>
34
+            <el-form ref="form" :model="form" label-width="80px">
35
+              <el-form-item label="经销商:">
36
+                <el-select v-model="form.dealer" placeholder="请选择经销商">
37
+                  <el-option v-for="(option, index) in dealer" :key="index" :label="option.dealer_name" :value="option.id"></el-option>
38
+                </el-select>
39
+              </el-form-item>
40
+            </el-form>
41
+          </div>
42
+        </el-col>
43
+      </el-row>
44
+
45
+    </div>
46
+
47
+    <el-row>
48
+      <el-col>
49
+        <el-form  :rules="tableRules" :model="recordInfo" ref="tableForm">
50
+          <el-table :data="recordInfo.recordData" :class="signAndWeighBoxPatients" style="width: 100%" border
51
+                    max-height="450"
52
+          >
53
+
54
+            <el-table-column label="操作" align="center" min-width="30">
55
+              <template slot-scope="scope">
56
+                <el-button
57
+                  size="mini"
58
+                  @click="handleEdit(scope.$index, scope.row)">+
59
+                </el-button>
60
+                <el-button
61
+                  size="mini"
62
+                  type="danger"
63
+                  @click="handleDelete(scope.$index, scope.row)">-
64
+                </el-button>
65
+              </template>
66
+            </el-table-column>
67
+
68
+            <el-table-column min-width="35" align="center">
69
+
70
+              <template slot="header" slot-scope="scope">
71
+                <span>物品类型<span style="color: red">*</span></span>
72
+              </template>
73
+
74
+              <template slot-scope="scope" >
75
+                <!--<span @click="showDialog(scope.$index, scope.row)" v-if="scope.row.good_type_id == 0" style="color:#c5c8cf">请输入类型</span>-->
76
+                <!--<span @click="showDialog(scope.$index, scope.row)" v-if="scope.row.good_type_id != 0">{{typeName(scope.row.good_type_id)}}</span>-->
77
+
78
+                <el-form-item  style="padding-top: 15px">
79
+                  <el-input placeholder="请输入物品类型"  v-model="scope.row.good_type_id" :value="typeName(scope.row.good_type_id)" @focus="showDialog(scope.$index, scope.row)" ></el-input>
80
+                </el-form-item>
81
+
82
+              </template>
83
+            </el-table-column>
84
+            <el-table-column min-width="35" align="center">
85
+              <template slot="header" slot-scope="scope">
86
+                <span>规格名称<span style="color: red">*</span></span>
87
+              </template>
88
+              <template slot-scope="scope">
89
+
90
+                <el-form-item  style="padding-top: 15px">
91
+                  <el-input placeholder="请输入规格名称"  v-model="scope.row.good_id" :value="specificationName(scope.row.good_id)" @focus="showDialog(scope.$index, scope.row)" ></el-input>
92
+                </el-form-item>
93
+
94
+              </template>
95
+            </el-table-column>
96
+
97
+
98
+            <el-table-column  min-width="23" align="center">
99
+              <template slot="header" slot-scope="scope">
100
+                <span>退货数量<span style="color: red">*</span></span>
101
+              </template>
102
+              <template slot-scope="scope">
103
+                <!--{{scope.row.warehousing_count}}-->
104
+                <!--<el-input type="number" v-model="scope.row.warehousing_count"   @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
105
+
106
+                <el-form-item :prop="'recordData.' + scope.$index + '.return_count'" :rules='tableRules.return_count' style="padding-top: 17px">
107
+                  <el-input type="number"  v-model="scope.row.return_count" ></el-input>
108
+                </el-form-item>
109
+              </template>
110
+            </el-table-column>
111
+
112
+          </el-table>
113
+        </el-form>
114
+      </el-col>
115
+
116
+
117
+      <span  class="dialog-footer" style="margin-top: 20px;float:right">
118
+        <el-button @click="back()">取 消</el-button>
119
+        <el-button type="primary" @click="submit()">确 定</el-button>
120
+      </span>
121
+
122
+    </el-row>
123
+  </div>
124
+</template>
125
+
126
+<script>
127
+  import { uParseTime } from '@/utils/tools'
128
+  import {
129
+    getSalesReturnConfig,
130
+    postSalesReturn,
131
+  } from '@/api/stock'
132
+  import SalesReturnDialog from './Dialog/salesReturnDialog'
133
+
134
+  export default {
135
+    components: { SalesReturnDialog},
136
+    name: 'salesReturnOrderAdd',
137
+
138
+    data() {
139
+      return {
140
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
141
+        return_time: '',
142
+        currentIndex: 0,
143
+        recordInfo: {
144
+          recordData: [],
145
+        },
146
+        tableRules: {
147
+          price: [
148
+            { required: true, message: '单价不能为空', trigger: 'blur' }
149
+          ],
150
+          return_count: [
151
+            { required: true, message: '数量不能为空', trigge: 'blur' }
152
+          ],
153
+        },
154
+        ruleForm: {
155
+          manufacturer: [
156
+            { required: true, message: '请选择厂商', trigger: 'change' }
157
+          ]
158
+
159
+        },
160
+        // prop
161
+        isVisibility: false,
162
+        propForm: {
163
+          goodType: [],
164
+          goodInfo: [],
165
+          goodUnit: [],
166
+        },
167
+        form: {
168
+          manufacturer: '',
169
+          dealer: ''
170
+        },
171
+
172
+        manufacturer: [],
173
+        dealer: [],
174
+        goodType: []
175
+      }
176
+    },
177
+    methods: {
178
+      comfirm: function(val) {
179
+        this.isVisibility = false
180
+        if (val.selectedGoodInfo.length > 0) {
181
+          for (let i = val.selectedGoodInfo.length - 1; ;i--) {
182
+            if (i == 0) {
183
+              this.recordInfo.recordData[this.currentIndex].good_type_id = val.goodTypeId
184
+              this.recordInfo.recordData[this.currentIndex].good_id = val.selectedGoodInfo[i].id
185
+            } else {
186
+              const tempForm = {}
187
+              tempForm['good_type_id'] = val.goodTypeId
188
+              tempForm['good_id'] = val.selectedGoodInfo[i].id
189
+              tempForm['return_count'] = ''
190
+              tempForm['price'] = ''
191
+              this.recordInfo.recordData.push(tempForm)
192
+            }
193
+          }
194
+        }
195
+
196
+        this.currentIndex = -1
197
+      }, cancle: function() {
198
+        this.isVisibility = false
199
+      }, GetConfigInfo: function() {
200
+        getSalesReturnConfig().then(response => {
201
+          if (response.data.state == 0) {
202
+            this.$message.error(response.data.msg)
203
+            return false
204
+          } else {
205
+            var warehouseList =  response.data.data.warehouseList
206
+            var warehouseInfoList =  response.data.data.warehouseInfoList
207
+            for (let i = 0; i <warehouseList.length; i++ ){
208
+              if(warehouseList[i].Manufacturer.id > 0){
209
+                this.manufacturer.push(warehouseList[i].Manufacturer)
210
+              }
211
+              if(warehouseList[i].Dealer.id > 0){
212
+                this.dealer.push(warehouseList[i].Dealer)
213
+              }
214
+            }
215
+
216
+            for (let i = 0; i < warehouseInfoList.length; i++) {
217
+              this.propForm.goodInfo.push(warehouseInfoList[i].GoodInfo)
218
+
219
+            }
220
+
221
+
222
+            const obj = {}
223
+            const obj2 = {}
224
+            const obj4 = {}
225
+            //去重复
226
+            this.manufacturer =  this.manufacturer.reduce((cur, next) => {
227
+              obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
228
+              return cur
229
+            }, [])
230
+            //去重复
231
+            this.dealer =  this.dealer.reduce((cur, next) => {
232
+              obj2[next.id] ? '' : obj2[next.id] = true && cur.push(next)
233
+              return cur
234
+            }, [])
235
+            this.propForm.goodInfo = this.propForm.goodInfo.reduce((cur, next) => {
236
+              obj4[next.id] ? '' : obj4[next.id] = true && cur.push(next)
237
+              return cur
238
+            }, [])
239
+
240
+
241
+          }
242
+        })
243
+      }, typeName: function(good_type_id) {
244
+        let name = ''
245
+        for (let i = 0; i < this.propForm.goodType.length; i++) {
246
+          if (this.propForm.goodType[i].id == good_type_id) {
247
+            name = this.propForm.goodType[i].type_name
248
+          }
249
+        }
250
+        return name
251
+      }, specificationName: function(good_info_id) {
252
+        let name = ''
253
+        for (let i = 0; i < this.propForm.goodInfo.length; i++) {
254
+          if (this.propForm.goodInfo[i].id == good_info_id) {
255
+            name = this.propForm.goodInfo[i].specification_name
256
+          }
257
+        }
258
+        return name
259
+      }, handleEdit: function(index, row) {
260
+        const tempObj = {}
261
+        tempObj['good_type_id'] = 0
262
+        tempObj['good_id'] = 0
263
+        tempObj['return_count'] = ''
264
+        tempObj['price'] = ''
265
+        this.recordInfo.recordData.push(tempObj)
266
+      }, handleDelete: function(index, row) {
267
+        this.recordInfo.recordData.splice(index, 1)
268
+      }, calculate: function(val) {
269
+
270
+        if (val == 0) {
271
+          return ''
272
+        }
273
+
274
+        return Math.round(parseFloat(val) * 100) / 100
275
+      }, getTime(val, temp) {
276
+        if (val != 0) {
277
+          return uParseTime(val, temp)
278
+        } else {
279
+          return ''
280
+        }
281
+      }, showDialog(index, row) {
282
+        this.currentIndex = index
283
+        if (this.form.manufacturer == '' || this.form.manufacturer == 0) {
284
+          this.$message.error('请先选择厂商')
285
+          return
286
+        } else {
287
+          this.isVisibility = true
288
+          console.log(this.form.manufacturer)
289
+          for (let i = 0; i < this.propForm.goodInfo.length; i++){
290
+            if(this.propForm.goodInfo[i].manufacturer == this.form.manufacturer){
291
+              this.propForm.goodType.push(this.propForm.goodInfo[i].GoodsType)
292
+            }
293
+
294
+          }
295
+          const obj3 = {}
296
+          this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
297
+            obj3[next.id] ? '' : obj3[next.id] = true && cur.push(next)
298
+            return cur
299
+          }, [])
300
+
301
+
302
+
303
+        }
304
+      }, back() {
305
+        this.$router.go(-1)
306
+      }, submit() {
307
+        this.$refs['tableForm'].validate((valid) => {
308
+          if (valid) {
309
+            if (this.form.manufacturer == 0) {
310
+              this.$message.error('厂商不能为空')
311
+              return
312
+            }
313
+            const array = this.recordInfo.recordData
314
+            let total = 0
315
+            for (let i = 0; i < array.length; i++) {
316
+              if (array[i].good_type_id == 0) {
317
+                this.$message.error('物品类型不能为空')
318
+                return
319
+              }
320
+              if (array[i].good_id == 0) {
321
+                this.$message.error('规格名称不能为空')
322
+                return
323
+              }
324
+              total = total + array[i].price * array[i].return_count
325
+            }
326
+            const params = {
327
+              'salesReturn': this.recordInfo.recordData
328
+            }
329
+            postSalesReturn(params,this.return_time,total,this.form.dealer,this.form.manufacturer).then(response=>{
330
+              if (response.data.state==0) {
331
+                this.$message.error(response.data.msg);
332
+                return false;
333
+              }else {
334
+                this.$notify({
335
+                  title: "成功",
336
+                  message: "退货成功",
337
+                  type: "success",
338
+                  duration: 2000
339
+                });
340
+                this.recordInfo.recordData = []
341
+                this.$router.back(-1)
342
+              }
343
+            });
344
+          } else {
345
+            return false
346
+          }
347
+        })
348
+      }
349
+    },
350
+    created() {
351
+      var year = new Date().getFullYear()
352
+      var month = new Date().getMonth() + 1
353
+      var day = new Date().getDate()
354
+      if (parseInt(month) < 10) {
355
+        month = '0' + month
356
+      }
357
+      if (parseInt(day) < 10) {
358
+        day = '0' + day
359
+      }
360
+      const endTime = year + '-' + month + '-' + day
361
+      this.return_time = endTime
362
+      const tempObj = {}
363
+      tempObj['good_type_id'] = 0
364
+      tempObj['good_id'] = 0
365
+      tempObj['return_count'] = ''
366
+      tempObj['price'] = ''
367
+      this.recordInfo.recordData.push(tempObj)
368
+      this.GetConfigInfo()
369
+      this.propForm.goodUnit = this.$store.getters.good_unit
370
+    }
371
+
372
+  }
373
+</script>
374
+
375
+<style rel="stylesheet/css" lang="scss" scoped>
376
+  .information {
377
+    border: 1px #dcdfe6 solid;
378
+    padding: 30px 20px 30px 20px;
379
+
380
+  .border {
381
+    border-bottom: 1px #dcdfe6 solid;
382
+    margin: 0px 0 20px 0;
383
+  }
384
+  }
385
+
386
+  .title {
387
+    background: #409eff;
388
+    height: 44px;
389
+    line-height: 44px;
390
+    padding: 0 0 0 10px;
391
+    color: #fff;
392
+    margin: 0 0 10px 0;
393
+  // border-radius: 4px 4px 0 0;
394
+  }
395
+
396
+  .edit_separater {
397
+    border-top: 1px solid rgb(233, 233, 233);
398
+    margin-top: 15px;
399
+    margin-bottom: 15px;
400
+  }
401
+
402
+</style>
403
+
404
+<style>
405
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
406
+    font-size: 12px;
407
+  }
408
+
409
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
410
+    background: #6fb5fa;
411
+  }
412
+
413
+</style>

+ 232 - 0
src/xt_pages/stock/salesReturnOrderDetail.vue Целия файл

@@ -0,0 +1,232 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <div class="filter-container">
6
+      <span style="font-size: 20px">退货单详情</span>
7
+      <el-row style="float:right;">
8
+        <span>{{ReturnInfo.salesReturn.order_number}}</span>
9
+      </el-row>
10
+    </div>
11
+
12
+
13
+
14
+    <div class="filter-container">
15
+      <span>单据日期:  {{ReturnInfo.salesReturn.return_time | parseTime('{y}-{m}-{d}')}} </span>
16
+      <span>厂商 {{getManufactuerName(ReturnInfo.salesReturn.manufacturer)}}</span>
17
+      <span>经销商 {{getDealerName(ReturnInfo.salesReturn.dealer)}}</span>
18
+    </div>
19
+
20
+    <div class="filter-container" style="margin-top: 10px">
21
+      <el-button size="small" icon="el-icon-edit" @click="editRecord">编辑</el-button>
22
+      <el-button size="small" icon="el-icon-delete" @click="deleteRecord">删除</el-button>
23
+    </div>
24
+
25
+    <el-row :gutter="12" style="margin-top: 10px">
26
+      <el-table :data="ReturnInfo.returnInfoData" :class="signAndWeighBoxPatients" style="width: 100%" border
27
+      >
28
+        <el-table-column min-width="35" align="center">
29
+          <template slot="header" slot-scope="scope">
30
+            <span>物品类型</span>
31
+          </template>
32
+
33
+          <template slot-scope="scope">
34
+            <span v-if="scope.row.good_type_id != 0">{{getTypeName(scope.row.good_type_id)}}</span>
35
+          </template>
36
+        </el-table-column>
37
+        <el-table-column min-width="35" align="center">
38
+          <template slot="header" slot-scope="scope">
39
+            <span>规格名称</span>
40
+          </template>
41
+          <template slot-scope="scope">
42
+            <span v-if="scope.row.good_id != 0">{{getSpecificationName(scope.row.good_id)}}</span>
43
+          </template>
44
+        </el-table-column>
45
+
46
+        <el-table-column min-width="23" align="center">
47
+          <template slot="header" slot-scope="scope">
48
+            <span>退货数量</span>
49
+          </template>
50
+          <template slot-scope="scope">
51
+            <span>{{scope.row.count}}</span>
52
+
53
+          </template>
54
+        </el-table-column>
55
+
56
+
57
+      </el-table>
58
+    </el-row>
59
+  </div>
60
+</template>
61
+
62
+<script>
63
+  import { uParseTime } from '@/utils/tools'
64
+  import { GetAllConfig,getReturnList,deleteSalesReturn } from '@/api/stock'
65
+
66
+  export default {
67
+    name: 'stockInOrderDetail',
68
+    created() {
69
+      const order_id = this.$route.query.id
70
+      this.GetConfigInfo()
71
+      this.GetOrderDetail(order_id)
72
+    },
73
+    data() {
74
+      return {
75
+        isEdit: 0,
76
+        checked: false,
77
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
78
+        goodType: [],
79
+        goodInfo: [],
80
+        manufacturer: [],
81
+        dealer: [],
82
+
83
+        ReturnInfo: {
84
+          loading: false,
85
+          returnInfoData: [],
86
+          salesReturn: {}
87
+        }
88
+      }
89
+    },
90
+    methods: {
91
+      getSpecificationName: function(id) {
92
+        let name = ''
93
+        for (let i = 0; i < this.goodInfo.length; i++) {
94
+          if (this.goodInfo[i].id == id) {
95
+            name = this.goodInfo[i].specification_name
96
+          }
97
+        }
98
+        return name
99
+      }, getTypeName: function(id) {
100
+        let name = ''
101
+        for (let i = 0; i < this.goodType.length; i++) {
102
+          if (this.goodType[i].id == id) {
103
+            name = this.goodType[i].type_name
104
+          }
105
+        }
106
+        return name
107
+      }, GetConfigInfo: function() {
108
+        GetAllConfig().then(response => {
109
+          if (response.data.state == 0) {
110
+            this.$message.error(response.data.msg)
111
+            return false
112
+          } else {
113
+            this.manufacturer = response.data.data.manufacturer
114
+            this.dealer = response.data.data.dealer
115
+            this.goodInfo = response.data.data.goodInfo
116
+            this.goodType = response.data.data.goodType
117
+          }
118
+        })
119
+      }, getManufactuerName: function(manufacturer_id) {
120
+        for (let i = 0; i < this.manufacturer.length; i++) {
121
+          if (this.manufacturer[i].id == manufacturer_id) {
122
+            return this.manufacturer[i].manufacturer_name
123
+          }
124
+        }
125
+      }, getDealerName: function(dealer_id) {
126
+        for (let i = 0; i < this.dealer.length; i++) {
127
+          if (this.dealer[i].id == dealer_id) {
128
+            return this.dealer[i].dealer_name
129
+          }
130
+        }
131
+      }, calculate: function(val) {
132
+        if (val == 0) {
133
+          return ''
134
+        }
135
+        return Math.round(parseFloat(val) * 100) / 100
136
+      }, GetOrderDetail: function(order_id) {
137
+        const params = {
138
+          'id': order_id
139
+        }
140
+        getReturnList(params).then(response => {
141
+          if (response.data.state == 0) {
142
+            this.$message.error(response.data.msg)
143
+            return false
144
+          } else {
145
+            for (let i = 0; i < response.data.data.list.length; i++) {
146
+              this.ReturnInfo.returnInfoData.push(response.data.data.list[i])
147
+            }
148
+            this.ReturnInfo.salesReturn = response.data.data.salesReturn
149
+          }
150
+        })
151
+      }, deleteRecord: function() {
152
+        const ids = []
153
+        ids.push(this.ReturnInfo.salesReturn.id)
154
+        const idStr = ids.join(',')
155
+
156
+        const params = {
157
+          ids: idStr
158
+        }
159
+
160
+        this.$confirm('确认删除退货单?', '删除退货单记录', {
161
+          confirmButtonText: '确定',
162
+          cancelButtonText: '取消',
163
+          type: 'warning'
164
+        }).then(() => {
165
+          deleteSalesReturn(params).then(response => {
166
+            if (response.data.state == 0) {
167
+              this.$message.error(response.data.msg)
168
+              return false
169
+            } else {
170
+              this.$notify({
171
+                title: '成功',
172
+                message: '删除成功',
173
+                type: 'success',
174
+                duration: 2000
175
+              })
176
+
177
+              this.$router.back(-1)
178
+            }
179
+          })
180
+        }).catch(() => {
181
+        })
182
+      }, editRecord: function() {
183
+        this.$emit('edit-record')
184
+      }
185
+    }
186
+  }
187
+</script>
188
+
189
+<style rel="stylesheet/css" lang="scss" scoped>
190
+  .information {
191
+    border: 1px #dcdfe6 solid;
192
+    padding: 30px 20px 30px 20px;
193
+
194
+  .border {
195
+    border-bottom: 1px #dcdfe6 solid;
196
+    margin: 0px 0 20px 0;
197
+  }
198
+
199
+  }
200
+
201
+  .title {
202
+    background: #409eff;
203
+    height: 44px;
204
+    line-height: 44px;
205
+    padding: 0 0 0 10px;
206
+    color: #fff;
207
+    margin: 0 0 10px 0;
208
+  }
209
+
210
+  .edit_separater {
211
+    border-top: 1px solid rgb(233, 233, 233);
212
+    margin-top: 15px;
213
+    margin-bottom: 15px;
214
+  }
215
+
216
+</style>
217
+
218
+<style>
219
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
220
+    font-size: 12px;
221
+  }
222
+
223
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
224
+    background: #6fb5fa;
225
+  }
226
+
227
+  .count {
228
+    color: #bd2c00;
229
+
230
+  }
231
+
232
+</style>

+ 24 - 0
src/xt_pages/stock/stockInDetail.vue Целия файл

@@ -0,0 +1,24 @@
1
+<template>
2
+  <stock-in-order-detail v-if="isEdit == 0"   v-on:edit-record="isEdit = 1"></stock-in-order-detail>
3
+  <stock-in-order-edit v-else></stock-in-order-edit>
4
+</template>
5
+
6
+<script>
7
+  import StockInOrderDetail from './stockInOrderDetail'
8
+  import StockInOrderEdit from './stockInOrderEdit'
9
+  export default {
10
+    name: 'stockInDeatail',
11
+    components: { StockInOrderEdit, StockInOrderDetail },
12
+    data() {
13
+      return {
14
+        isEdit: 0
15
+      }
16
+  }
17
+
18
+  }
19
+
20
+</script>
21
+
22
+<style scoped>
23
+
24
+</style>

+ 506 - 0
src/xt_pages/stock/stockInOrder.vue Целия файл

@@ -0,0 +1,506 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+
6
+    <div class="filter-container">
7
+
8
+
9
+      <el-row style="float:right;">
10
+        <el-button @click="handleWarehouse" type="primary">新增</el-button>
11
+      </el-row>
12
+    </div>
13
+
14
+    <div class="filter-container" style="margin-top:20px">
15
+      <el-input style="width: 300px;" class="filter-item" placeholder="单据日期/单据编码/制单人/供应商"/>
16
+      <el-button class="filter-item" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
17
+    </div>
18
+
19
+    <div class="filter-container">
20
+      <span>入库时间:</span>
21
+      <el-date-picker v-model="start_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
22
+                      type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
23
+                      value-format="yyyy-MM-dd" @change="startTimeChange"></el-date-picker>
24
+      <span class="">-</span>
25
+      <el-date-picker v-model="end_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
26
+                      type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
27
+                      value-format="yyyy-MM-dd" @change="endTimeChange"></el-date-picker>
28
+    </div>
29
+
30
+    <div class="filter-container" style="margin-top: 10px">
31
+      <el-checkbox style="width: 30px" v-model="checked" @change="changeAllSelected">全选</el-checkbox>
32
+      <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
33
+
34
+    </div>
35
+
36
+    <el-row :gutter="12" style="margin-top: 10px">
37
+      <el-table
38
+        :data="Warehouse.warehouseDate"
39
+        :class="signAndWeighBoxPatients"
40
+        style="width: 100%" border
41
+        highlight-current-row
42
+        v-loading="Warehouse.loading"
43
+        ref="multipleTable"
44
+        @selection-change="select"
45
+
46
+      >
47
+        <el-table-column
48
+          type="selection"
49
+          width="55">
50
+        </el-table-column>
51
+
52
+        <el-table-column label="单据日期" align="center">
53
+          <template slot-scope="scope">
54
+            {{ scope.row.warehousing_time | parseTime('{y}-{m}-{d}')}}
55
+          </template>
56
+        </el-table-column>
57
+
58
+        <el-table-column label="单据编号" align="center">
59
+          <template slot-scope="scope">
60
+            {{scope.row.warehousing_order}}
61
+          </template>
62
+        </el-table-column>
63
+
64
+        <el-table-column label="制单人" align="center">
65
+          <template slot-scope="scope">
66
+            {{getXuserName(scope.row.creater)}}
67
+          </template>
68
+        </el-table-column>
69
+
70
+
71
+        <el-table-column label="厂家" align="center">
72
+          <template slot-scope="scope">
73
+            {{getManufactuerName(scope.row.manufacturer)}}
74
+          </template>
75
+        </el-table-column>
76
+
77
+        <el-table-column label="经销商" align="center">
78
+          <template slot-scope="scope">
79
+            {{getDealerName(scope.row.dealer)}}
80
+          </template>
81
+        </el-table-column>
82
+
83
+        <el-table-column label="操作" align="center">
84
+          <template slot-scope="scope">
85
+            <el-button
86
+              size="mini"
87
+              type="primary"
88
+              icon="el-icon-edit"
89
+              @click="handleEdit(scope.$index, scope.row)">
90
+            </el-button>
91
+
92
+            <el-button
93
+              size="mini"
94
+              type="danger"
95
+              icon="el-icon-delete"
96
+              @click="handleDelete(scope.$index, scope.row)">
97
+            </el-button>
98
+
99
+          </template>
100
+        </el-table-column>
101
+
102
+      </el-table>
103
+
104
+      <el-pagination
105
+        @size-change="handleSizeChange"
106
+        @current-change="handleCurrentChange"
107
+        :page-sizes="[7]"
108
+        :page-size="7"
109
+        background
110
+        style="margin-top:20px;float: right"
111
+        layout="total, sizes, prev, pager, next, jumper"
112
+        :total="total">
113
+      </el-pagination>
114
+
115
+    </el-row>
116
+  </div>
117
+</template>
118
+
119
+<script>
120
+  import { uParseTime } from '@/utils/tools'
121
+  import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from '@/api/doctor'
122
+  import {
123
+    deleteWarehouseInfo,
124
+    GetAllConfig,
125
+    GetAllGoodInfo,
126
+    GetAllGoodType,
127
+    getWarehouseInfoList,
128
+    getWarehouseList
129
+  } from '@/api/stock'
130
+
131
+  export default {
132
+    name: 'stockIn',
133
+    created() {
134
+      var year = new Date().getFullYear()
135
+      var month = new Date().getMonth() + 1
136
+      var day = new Date().getDate()
137
+      if (parseInt(month) < 10) {
138
+        month = '0' + month
139
+      }
140
+      if (parseInt(day) < 10) {
141
+        day = '0' + day
142
+      }
143
+      const endTime = year + '-' + month + '-' + day
144
+      this.end_time = endTime
145
+
146
+      var year = new Date().getFullYear()
147
+      var month = new Date().getMonth()
148
+      var day = new Date().getDate()
149
+      if (parseInt(month) < 10) {
150
+        month = '0' + month
151
+      }
152
+      if (parseInt(day) < 10) {
153
+        day = '0' + day
154
+      }
155
+      const startTime = year + '-' + month + '-' + day
156
+      this.start_time = startTime
157
+      this.GetWarehouse()
158
+      this.GetConfigInfo()
159
+      this.fetchAllAdminUsers()
160
+    },
161
+    data() {
162
+      return {
163
+        page: 1,
164
+        limit: 7,
165
+        checked: false,
166
+        total: 0,
167
+        pageTotal: 0,
168
+        pageSelect: 0,
169
+        adminUserOptions: [],
170
+        multipleSelection: [],
171
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
172
+        start_time: '',
173
+        end_time: '',
174
+        goodType: [],
175
+        goodInfo: [],
176
+        manufacturer: [],
177
+        selectedTableData: [],
178
+        dealer: [],
179
+        Warehouse: {
180
+          loading: false,
181
+          warehouseDate: [],
182
+          tableCurrentIndex: ''
183
+        },
184
+
185
+        WarehouseInfo: {
186
+          loading: false,
187
+          warehouseInfoDate: []
188
+        }
189
+      }
190
+    },
191
+    methods: {
192
+      GetWarehouse: function() {
193
+        const Params = {
194
+          page: this.page,
195
+          limit: this.limit,
196
+          start_time: this.start_time,
197
+          end_time: this.end_time
198
+        }
199
+        this.Warehouse.warehouseDate = []
200
+        getWarehouseList(Params).then(response => {
201
+          if (response.data.state == 0) {
202
+            this.Warehouse.loading = false
203
+            this.$message.error(response.data.msg)
204
+            return false
205
+          } else {
206
+            this.Warehouse.loading = false
207
+            this.total = response.data.data.total
208
+            for (let i = 0; i < response.data.data.list.length; i++) {
209
+              this.Warehouse.warehouseDate.push(response.data.data.list[i])
210
+            }
211
+          }
212
+        })
213
+      }, tableRowClassName({ row, rowIndex }) {
214
+        // 把每一行的索引放进row
215
+        row.index = rowIndex
216
+      },
217
+      onRowClick(row, event, column) {
218
+        this.WarehouseInfo.warehouseInfoDate = []
219
+        this.Warehouse.tableCurrentIndex = row.index
220
+        const params = {
221
+          'id': row.id
222
+        }
223
+        this.WarehouseInfo.loading = true
224
+        getWarehouseInfoList(params).then(response => {
225
+          if (response.data.state == 0) {
226
+            this.WarehouseInfo.loading = false
227
+            this.$message.error(response.data.msg)
228
+            return false
229
+          } else {
230
+            this.WarehouseInfo.loading = false
231
+            for (let i = 0; i < response.data.data.info.length; i++) {
232
+              this.WarehouseInfo.warehouseInfoDate.push(response.data.data.info[i])
233
+            }
234
+          }
235
+        })
236
+      }, getXuserName(id) {
237
+        if (id <= 0) {
238
+          return ''
239
+        }
240
+        var name = ''
241
+        if (this.adminUserOptions == null || typeof (this.adminUserOptions.length) === 'undefined') {
242
+          return name
243
+        }
244
+        var leng = this.adminUserOptions.length
245
+        if (leng == 0) {
246
+          return name
247
+        }
248
+        for (let index = 0; index < leng; index++) {
249
+          if (this.adminUserOptions[index].id == id) {
250
+            name = this.adminUserOptions[index].name
251
+            break
252
+          }
253
+        }
254
+        return name
255
+      }, fetchAllDoctorAndNurse() {
256
+        fetchAllDoctorAndNurse().then(response => {
257
+          if (response.data.state == 1) {
258
+            this.doctorOptions = response.data.data.doctors
259
+          }
260
+        })
261
+      },
262
+      fetchAllAdminUsers() {
263
+        fetchAllAdminUsers().then(response => {
264
+          console.log(response)
265
+          if (response.data.state == 1) {
266
+            this.adminUserOptions = response.data.data.users
267
+            var alen = this.adminUserOptions.length
268
+            for (let index = 0; index < alen; index++) {
269
+              if (this.adminUserOptions[index].user_type == 2) {
270
+                // this.doctorOptions.push(this.adminUserOptions[index]);
271
+              }
272
+            }
273
+          }
274
+        })
275
+      }, getSpecificationName: function(id) {
276
+        let name = ''
277
+        for (let i = 0; i < this.goodInfo.length; i++) {
278
+          if (this.goodInfo[i].id == id) {
279
+            name = this.goodInfo[i].specification_name
280
+          }
281
+        }
282
+
283
+        return name
284
+      }, getTypeName: function(id) {
285
+        let name = ''
286
+        for (let i = 0; i < this.goodType.length; i++) {
287
+          if (this.goodType[i].id == id) {
288
+            name = this.goodType[i].type_name
289
+          }
290
+        }
291
+        return name
292
+      }, GetAllGoodType: function() {
293
+        GetAllGoodType().then(response => {
294
+          if (response.data.state == 0) {
295
+            this.$message.error(response.data.msg)
296
+            return false
297
+          } else {
298
+            for (let i = 0; i < response.data.data.goodType.length; i++) {
299
+              this.goodType.push(response.data.data.goodType[i])
300
+            }
301
+          }
302
+        })
303
+      }, GetAllGoodInfo: function() {
304
+        GetAllGoodInfo().then(response => {
305
+          if (response.data.state == 0) {
306
+            this.$message.error(response.data.msg)
307
+            return false
308
+          } else {
309
+            for (let i = 0; i < response.data.data.goodInfo.length; i++) {
310
+              this.goodInfo.push(response.data.data.goodInfo[i])
311
+            }
312
+          }
313
+        })
314
+      }, clicks: function() {
315
+        console.log(this.WarehouseInfo.warehouseInfoDate)
316
+      }, handleWarehouse: function() {
317
+        this.$router.push({ path: '/stock/in/add' })
318
+      }, handleReturnSales: function() {
319
+        // this.$router.push({path:'/patients/create'}
320
+        if (this.multipleSelection.length <= 0) {
321
+          this.$message.error('请选择退货物品')
322
+          return
323
+        }
324
+
325
+        const ids = []
326
+        for (let i = 0; i < this.multipleSelection.length; i++) {
327
+          ids.push(this.multipleSelection[i].id)
328
+        }
329
+        this.$router.push({ name: 'salesReturn', query: { id: ids.join('&') }})
330
+      }, handleReturnSalesRecord: function() {
331
+        this.$router.push({ name: 'salesReutrnRecord' })
332
+      }, handleWarehouseRecord: function() {
333
+        this.$router.push({ name: 'warehouseRecord' })
334
+      }, handleSelectionChange: function(val) {
335
+        this.multipleSelection = val
336
+      }, handleSizeChange(val) {
337
+        this.limit = val
338
+        this.GetWarehouse()
339
+      }, handleCurrentChange(val) {
340
+        this.page = val
341
+        this.GetWarehouse()
342
+      }, startTimeChange(val) {
343
+        this.GetWarehouse()
344
+      }, endTimeChange(val) {
345
+        this.GetWarehouse()
346
+      }, calculate: function(val) {
347
+        return Math.round(parseFloat(val) * 100) / 100
348
+      }, GetConfigInfo: function() {
349
+        GetAllConfig().then(response => {
350
+          if (response.data.state == 0) {
351
+            this.$message.error(response.data.msg)
352
+            return false
353
+          } else {
354
+            this.manufacturer = response.data.data.manufacturer
355
+            this.dealer = response.data.data.dealer
356
+          }
357
+        })
358
+      }, getManufactuerName: function(manufacturer_id) {
359
+        for (let i = 0; i < this.manufacturer.length; i++) {
360
+          if (this.manufacturer[i].id == manufacturer_id) {
361
+            return this.manufacturer[i].manufacturer_name
362
+          }
363
+        }
364
+      }, getDealerName: function(dealer_id) {
365
+        for (let i = 0; i < this.dealer.length; i++) {
366
+          if (this.dealer[i].id == dealer_id) {
367
+            return this.dealer[i].dealer_name
368
+          }
369
+        }
370
+      }, handleEdit: function(index, row) {
371
+        this.$router.push({ name: 'stockInDetail', query: { id: row.id }})
372
+      }, handleDelete: function(index, row) {
373
+        const ids = []
374
+        ids.push(row.id)
375
+        const idStr = ids.join(',')
376
+
377
+        const params = {
378
+          ids: idStr
379
+        }
380
+
381
+        this.$confirm('确认删除入库单记录?', '删除入库单记录', {
382
+          confirmButtonText: '确定',
383
+          cancelButtonText: '取消',
384
+          type: 'warning'
385
+        }).then(() => {
386
+          deleteWarehouseInfo(params).then(response => {
387
+            if (response.data.state == 0) {
388
+              this.$message.error(response.data.msg)
389
+              return false
390
+            } else {
391
+              this.$notify({
392
+                title: '成功',
393
+                message: '删除成功',
394
+                type: 'success',
395
+                duration: 2000
396
+              })
397
+              for (let i = 0; i < ids.length; i++) {
398
+                for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
399
+                  if (ids[i] == this.Warehouse.warehouseDate[y].id) {
400
+                    this.Warehouse.warehouseDate.splice(y, 1)
401
+                  }
402
+                }
403
+              }
404
+            }
405
+          })
406
+        }).catch(() => {
407
+        })
408
+      }, changeAllSelected: function(val) {
409
+        if (val) {
410
+          this.$refs.multipleTable.toggleAllSelection()
411
+        } else {
412
+          this.$refs.multipleTable.clearSelection()
413
+        }
414
+      }, select(selection) {
415
+        this.selectedTableData = selection
416
+      }, batchDelete() {
417
+        if (this.selectedTableData.length <= 0) {
418
+          this.$message.error('请选择要删除的记录')
419
+          return
420
+        }
421
+        const ids = []
422
+        for (let i = 0; i < this.selectedTableData.length; i++) {
423
+          ids.push(this.selectedTableData[i].id)
424
+        }
425
+        const idStr = ids.join(',')
426
+        const params = {
427
+          ids: idStr
428
+        }
429
+        this.$confirm('确认删除入库单记录?', '删除入库单记录', {
430
+          confirmButtonText: '确定',
431
+          cancelButtonText: '取消',
432
+          type: 'warning'
433
+        }).then(() => {
434
+          deleteWarehouseInfo(params).then(response => {
435
+            if (response.data.state == 0) {
436
+              this.$message.error(response.data.msg)
437
+              return false
438
+            } else {
439
+              this.$notify({
440
+                title: '成功',
441
+                message: '删除成功',
442
+                type: 'success',
443
+                duration: 2000
444
+              })
445
+
446
+              for (let i = 0; i < ids.length; i++) {
447
+                for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
448
+                  if (ids[i] == this.Warehouse.warehouseDate[y].id) {
449
+                    this.Warehouse.warehouseDate.splice(y, 1)
450
+                  }
451
+                }
452
+              }
453
+            }
454
+          })
455
+        }).catch(() => {
456
+        })
457
+      }
458
+    }
459
+  }
460
+</script>
461
+
462
+<style rel="stylesheet/css" lang="scss" scoped>
463
+  .information {
464
+    border: 1px #dcdfe6 solid;
465
+    padding: 30px 20px 30px 20px;
466
+
467
+  .border {
468
+    border-bottom: 1px #dcdfe6 solid;
469
+    margin: 0px 0 20px 0;
470
+  }
471
+
472
+  }
473
+
474
+  .title {
475
+    background: #409eff;
476
+    height: 44px;
477
+    line-height: 44px;
478
+    padding: 0 0 0 10px;
479
+    color: #fff;
480
+    margin: 0 0 10px 0;
481
+
482
+  }
483
+
484
+  .edit_separater {
485
+    border-top: 1px solid rgb(233, 233, 233);
486
+    margin-top: 15px;
487
+    margin-bottom: 15px;
488
+  }
489
+
490
+</style>
491
+
492
+<style>
493
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
494
+    font-size: 12px;
495
+  }
496
+
497
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
498
+    background: #6fb5fa;
499
+  }
500
+
501
+  .count {
502
+    color: #bd2c00;
503
+
504
+  }
505
+
506
+</style>

+ 611 - 0
src/xt_pages/stock/stockInOrderAdd.vue Целия файл

@@ -0,0 +1,611 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <stock-in-dialog :propForm="propForm"
6
+                     :visibility="isVisibility"
7
+                     v-on:dialog-comfirm="comfirm"
8
+                     v-on:dialog-cancle="cancle"></stock-in-dialog>
9
+
10
+    <div class="filter-container">
11
+
12
+      <el-row>
13
+        <el-col :span="8"><div>
14
+          <span>入库时间:</span>
15
+          <el-date-picker v-model="warehousing_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
16
+                          type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
17
+                          value-format="yyyy-MM-dd"></el-date-picker>
18
+        </div></el-col>
19
+
20
+
21
+        <el-col :span="8">
22
+          <div>
23
+            <el-form ref="form" :model="form" :rules="ruleForm" label-width="80px">
24
+              <el-form-item label="厂商:" prop="manufacturer">
25
+                <el-select v-model="form.manufacturer" placeholder="请选择厂商">
26
+                  <el-option v-for="(option, index) in manufacturer" :key="index" :label="option.manufacturer_name" :value="option.id"></el-option>
27
+                </el-select>
28
+              </el-form-item>
29
+            </el-form>
30
+          </div>
31
+        </el-col>
32
+        <el-col :span="8">
33
+          <div>
34
+            <el-form ref="form" :model="form" label-width="80px">
35
+              <el-form-item label="经销商:">
36
+                <el-select v-model="form.dealer" placeholder="请选择经销商">
37
+                  <el-option v-for="(option, index) in dealer" :key="index" :label="option.dealer_name" :value="option.id"></el-option>
38
+                </el-select>
39
+              </el-form-item>
40
+            </el-form>
41
+          </div>
42
+        </el-col>
43
+      </el-row>
44
+
45
+    </div>
46
+
47
+    <el-row>
48
+      <el-col>
49
+        <el-form  :rules="tableRules" :model="recordInfo" ref="tableForm">
50
+          <el-table :data="recordInfo.recordData" :class="signAndWeighBoxPatients" style="width: 100%" border
51
+                    max-height="450"
52
+          >
53
+
54
+            <el-table-column label="操作" align="center" min-width="30">
55
+              <template slot-scope="scope">
56
+                <el-button
57
+                  size="mini"
58
+                  @click="handleEdit(scope.$index, scope.row)">+
59
+                </el-button>
60
+                <el-button
61
+                  size="mini"
62
+                  type="danger"
63
+                  @click="handleDelete(scope.$index, scope.row)">-
64
+                </el-button>
65
+              </template>
66
+            </el-table-column>
67
+
68
+            <el-table-column min-width="35" align="center">
69
+
70
+              <template slot="header" slot-scope="scope">
71
+                <span>物品类型<span style="color: red">*</span></span>
72
+              </template>
73
+
74
+              <template slot-scope="scope" >
75
+                <!--<span @click="showDialog(scope.$index, scope.row)" v-if="scope.row.good_type_id == 0" style="color:#c5c8cf">请输入类型</span>-->
76
+                <!--<span @click="showDialog(scope.$index, scope.row)" v-if="scope.row.good_type_id != 0">{{typeName(scope.row.good_type_id)}}</span>-->
77
+
78
+                <el-form-item  style="padding-top: 15px">
79
+                  <el-input placeholder="请输入物品类型"  v-model="scope.row.good_type_id" :value="typeName(scope.row.good_type_id)" @focus="showDialog(scope.$index, scope.row)" ></el-input>
80
+                </el-form-item>
81
+
82
+              </template>
83
+            </el-table-column>
84
+            <el-table-column min-width="35" align="center">
85
+              <template slot="header" slot-scope="scope">
86
+                <span>规格名称<span style="color: red">*</span></span>
87
+              </template>
88
+              <template slot-scope="scope">
89
+
90
+                <el-form-item  style="padding-top: 15px">
91
+                  <el-input placeholder="请输入规格名称"  v-model="scope.row.good_id" :value="specificationName(scope.row.good_id)" @focus="showDialog(scope.$index, scope.row)" ></el-input>
92
+                </el-form-item>
93
+
94
+              </template>
95
+            </el-table-column>
96
+
97
+
98
+            <el-table-column  min-width="23" align="center">
99
+              <template slot="header" slot-scope="scope">
100
+                <span>单价<span style="color: red">*</span></span>
101
+              </template>
102
+              <template slot-scope="scope">
103
+                <!--<el-input type="number" v-model="scope.row.price"  @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
104
+                <el-form-item :prop="'recordData.' + scope.$index + '.price'" :rules='tableRules.price' style="padding-top: 17px">
105
+                  <el-input type="number"  v-model="scope.row.price" ></el-input>
106
+                </el-form-item>
107
+
108
+
109
+              </template>
110
+            </el-table-column>
111
+
112
+            <el-table-column  min-width="23" align="center">
113
+              <template slot="header" slot-scope="scope">
114
+                <span>入库数量<span style="color: red">*</span></span>
115
+              </template>
116
+              <template slot-scope="scope">
117
+                <!--{{scope.row.warehousing_count}}-->
118
+                <!--<el-input type="number" v-model="scope.row.warehousing_count"   @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
119
+
120
+                <el-form-item :prop="'recordData.' + scope.$index + '.warehousing_count'" :rules='tableRules.warehousing_count' style="padding-top: 17px">
121
+                  <el-input type="number"  v-model="scope.row.warehousing_count" ></el-input>
122
+                </el-form-item>
123
+              </template>
124
+            </el-table-column>
125
+
126
+            <el-table-column label="总价" min-width="20" align="center">
127
+              <template slot-scope="scope">
128
+                {{calculate(scope.row.price*scope.row.warehousing_count)}}
129
+              </template>
130
+            </el-table-column>
131
+
132
+            <el-table-column  align="center" min-width="25">
133
+              <template slot="header" slot-scope="scope">
134
+                <span>批号<span style="color: red">*</span></span>
135
+              </template>
136
+              <template slot-scope="scope">
137
+                <!--<el-input  v-model="scope.row.numbers"></el-input>-->
138
+
139
+                <el-form-item :prop="'recordData.' + scope.$index + '.number'" :rules='tableRules.number' style="padding-top: 17px">
140
+                  <el-input  v-model="scope.row.number" ></el-input>
141
+                </el-form-item>
142
+
143
+              </template>
144
+            </el-table-column>
145
+            <el-table-column label="生产日期" min-width="40" align="center">
146
+              <template slot-scope="scope" >
147
+                <!--{{scope.row.product_date | parseTime("{y}-{m}-{d}")}}-->
148
+                <el-date-picker prefix-icon="el-icon-date" style="width: 145px" v-model="scope.row.product_date"
149
+                                type="date" placeholder="选择日期时间" format="yyyy-MM-dd"
150
+                                value-format="yyyy-MM-dd"></el-date-picker>
151
+
152
+              </template>
153
+            </el-table-column>
154
+            <el-table-column label="有效日期" min-width="40" align="center">
155
+              <template slot-scope="scope">
156
+                <!--{{ scope.row.expiry_date | parseTime("{y}-{m}-{d}")}}-->
157
+                <el-date-picker  prefix-icon="el-icon-date" style="width: 145px" v-model="scope.row.expiry_date"
158
+                                type="date" placeholder="选择日期时间"  format="yyyy-MM-dd"
159
+                                value-format="yyyy-MM-dd"></el-date-picker>
160
+
161
+              </template>
162
+            </el-table-column>
163
+            <el-table-column label="备注" min-width="20" align="center">
164
+              <template slot-scope="scope">
165
+                  <el-input  v-model="scope.row.remark"></el-input>
166
+              </template>
167
+            </el-table-column>
168
+          </el-table>
169
+        </el-form>
170
+      </el-col>
171
+
172
+
173
+      <span  class="dialog-footer" style="margin-top: 20px;float:right">
174
+        <el-button @click="back()">取 消</el-button>
175
+        <el-button type="primary" @click="submit()">确 定</el-button>
176
+      </span>
177
+
178
+    </el-row>
179
+  </div>
180
+</template>
181
+
182
+<script>
183
+  import stockInDialog from './Dialog/stockInDialog'
184
+  import { uParseTime } from '@/utils/tools'
185
+
186
+import {
187
+    GetAllGoodInfo,
188
+    GetAllGoodType,
189
+    postWarehouse,
190
+    GetAllConfig,
191
+    GetAllGoodInfoByID,
192
+    getWarehouseInfoByOrdeNumber,
193
+    modifyWarehouseInfo,
194
+    deleteWarehouseInfo
195
+  } from '@/api/stock'
196
+
197
+export default {
198
+    components: { stockInDialog },
199
+    name: 'stockIn',
200
+
201
+    data() {
202
+      var checkGoodId = (rule, value, callback) => {
203
+        setTimeout(() => {
204
+          if (value == '' || value == 0) {
205
+            return callback(new Error('规格名称不能为空'))
206
+          }
207
+        }, 2000)
208
+      }
209
+
210
+      return {
211
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
212
+        warehousing_time: '',
213
+        adminUserOptions: null,
214
+        currentIndex: 0,
215
+
216
+        recordInfo: {
217
+          recordData: [],
218
+          stock_in_code: '',
219
+          current_index: ''
220
+
221
+        },
222
+        tableRules: {
223
+          price: [
224
+            { required: true, message: '单价不能为空', trigger: 'blur' }
225
+          ],
226
+          warehousing_count: [
227
+            { required: true, message: '数量不能为空', trigge: 'blur' }
228
+          ],
229
+          number: [
230
+            { required: true, message: '批号不能为空', trigge: 'blur' }
231
+          ],
232
+          good_id: [
233
+            { validator: checkGoodId, trigger: 'blur' }
234
+          ]
235
+
236
+        },
237
+        ruleForm: {
238
+          manufacturer: [
239
+            { required: true, message: '请选择厂商', trigger: 'change' }
240
+          ]
241
+
242
+        },
243
+
244
+        total: '',
245
+        product_date: '',
246
+        expiry_date: '',
247
+        numbers: '',
248
+
249
+        // prop
250
+        isVisibility: false,
251
+        propForm: {
252
+          goodType: [],
253
+          goodInfo: [],
254
+          goodUnit: [],
255
+          title: '入库',
256
+          formValue: {
257
+            good_type_id: '',
258
+            good_id: '',
259
+            number: '',
260
+            product_date: '',
261
+            expiry_date: '',
262
+            warehousing_count: '',
263
+            price: '',
264
+            remark: '',
265
+            dealer: '',
266
+            manufacturer: ''
267
+
268
+          },
269
+          isCreated: 1
270
+
271
+        },
272
+
273
+        goodInfo: {
274
+          loading: false,
275
+          goodTypeData: [],
276
+          type_code: ''
277
+        },
278
+        form: {
279
+          manufacturer: '',
280
+          dealer: ''
281
+        },
282
+
283
+        formValue: {
284
+          good_type_id: '',
285
+          good_id: '',
286
+          number: '',
287
+          product_date: '',
288
+          expiry_date: '',
289
+          warehousing_count: '',
290
+          price: '',
291
+          remark: '',
292
+          dealer: '',
293
+          manufacturer: ''
294
+
295
+        },
296
+
297
+        manufacturer: [],
298
+        dealer: [],
299
+        goodType: []
300
+      }
301
+  },
302
+    methods: {
303
+      handleSave: function() {
304
+        if (this.recordInfo.recordData.length <= 0) {
305
+          this.$message.error('请添加入库信息')
306
+          return
307
+        }
308
+        sessionStorage.removeItem('warehousing_orders')
309
+        this.$router.back(-1)
310
+      }, handleCancle: function() {
311
+        this.$confirm('是否放弃编辑返回上一页?', '放弃编辑', {
312
+          confirmButtonText: '确定',
313
+          cancelButtonText: '取消',
314
+          type: 'warning'
315
+        }).then(() => {
316
+          sessionStorage.removeItem('warehousing_orders')
317
+          this.$router.back(-1)
318
+        }).catch(() => {
319
+
320
+        })
321
+      }, handleCreate: function() {
322
+        this.propForm.formValue = {}
323
+        this.propForm.isCreated = 1
324
+        this.isVisibility = true
325
+      }, comfirm: function(val) {
326
+        this.isVisibility = false
327
+        if (val.selectedGoodInfo.length > 0) {
328
+          for (let i = val.selectedGoodInfo.length - 1; ;i--) {
329
+            if (i == 0) {
330
+              this.recordInfo.recordData[this.currentIndex].good_type_id = val.goodTypeId
331
+              this.recordInfo.recordData[this.currentIndex].good_id = val.selectedGoodInfo[i].id
332
+            } else {
333
+              const tempForm = {}
334
+              tempForm['good_type_id'] = val.goodTypeId
335
+              tempForm['good_id'] = val.selectedGoodInfo[i].id
336
+              tempForm['number'] = ''
337
+              tempForm['product_date'] = 0
338
+              tempForm['expiry_date'] = 0
339
+              tempForm['warehousing_count'] = ''
340
+              tempForm['price'] = ''
341
+              tempForm['remark'] = ''
342
+              tempForm['dealer'] = ''
343
+              tempForm['manufacturer'] = ''
344
+              this.recordInfo.recordData.push(tempForm)
345
+            }
346
+          }
347
+        }
348
+
349
+        this.currentIndex = -1
350
+      }, cancle: function() {
351
+        this.isVisibility = false
352
+      }, GetAllGoodType: function() {
353
+        GetAllGoodType().then(response => {
354
+          if (response.data.state == 0) {
355
+            this.$message.error(response.data.msg)
356
+            return false
357
+          } else {
358
+            for (let i = 0; i < response.data.data.goodType.length; i++) {
359
+              this.propForm.goodType.push(response.data.data.goodType[i])
360
+            }
361
+          }
362
+        })
363
+      }, GetAllGoodInfo: function() {
364
+        GetAllGoodInfo().then(response => {
365
+          if (response.data.state == 0) {
366
+            this.$message.error(response.data.msg)
367
+            return false
368
+          } else {
369
+            for (let i = 0; i < response.data.data.goodInfo.length; i++) {
370
+              this.propForm.goodInfo.push(response.data.data.goodInfo[i])
371
+            }
372
+          }
373
+        })
374
+      }, GetConfigInfo: function() {
375
+        GetAllConfig().then(response => {
376
+          if (response.data.state == 0) {
377
+            this.$message.error(response.data.msg)
378
+            return false
379
+          } else {
380
+            this.manufacturer = response.data.data.manufacturer
381
+            this.dealer = response.data.data.dealer
382
+            this.goodType = response.data.data.goodType
383
+            this.goodInfo = response.data.data.goodInfo
384
+          }
385
+        })
386
+      }, typeName: function(good_type_id) {
387
+        let name = '请输入物品类型'
388
+        for (let i = 0; i < this.goodType.length; i++) {
389
+          if (this.goodType[i].id == good_type_id) {
390
+            name = this.goodType[i].type_name
391
+          }
392
+        }
393
+        return name
394
+      }, specificationName: function(good_info_id) {
395
+        let name = ''
396
+        for (let i = 0; i < this.goodInfo.length; i++) {
397
+          if (this.goodInfo[i].id == good_info_id) {
398
+            name = this.goodInfo[i].specification_name
399
+          }
400
+        }
401
+        return name
402
+      }, handleEdit: function(index, row) {
403
+        const tempObj = {}
404
+        tempObj['good_type_id'] = 0
405
+        tempObj['good_id'] = 0
406
+        tempObj['number'] = ''
407
+        tempObj['product_date'] = ''
408
+        tempObj['expiry_date'] = ''
409
+        tempObj['warehousing_count'] = ''
410
+        tempObj['price'] = ''
411
+        tempObj['remark'] = ''
412
+        tempObj['dealer'] = ''
413
+        tempObj['manufacturer'] = ''
414
+        this.recordInfo.recordData.push(tempObj)
415
+      }, handleDelete: function(index, row) {
416
+        this.recordInfo.recordData.splice(index, 1)
417
+      }, calculate: function(val) {
418
+        if (val == 0) {
419
+          return ''
420
+        }
421
+        return Math.round(parseFloat(val) * 100) / 100
422
+      }, GetWarehouseInfoByOrdeNumber: function() {
423
+        const params = {
424
+          'warehousing_order': sessionStorage.getItem('warehousing_orders')
425
+        }
426
+        this.recordInfo.recordData = []
427
+        getWarehouseInfoByOrdeNumber(params).then(response => {
428
+          if (response.data.state != 0) {
429
+            for (let i = 0; i < response.data.data.info.length; i++) {
430
+              this.recordInfo.recordData.push(response.data.data.info[i])
431
+            }
432
+          }
433
+        })
434
+      }, getTime(val, temp) {
435
+        if (val != 0) {
436
+          return uParseTime(val, temp)
437
+        } else {
438
+          return ''
439
+        }
440
+      }, showDialog(index, row) {
441
+        this.currentIndex = index
442
+        if (this.form.manufacturer == '' || this.form.manufacturer == 0) {
443
+          this.$message.error('请先选择厂商')
444
+          return
445
+        } else {
446
+          this.isVisibility = true
447
+          const params = {
448
+            id: this.form.manufacturer
449
+          }
450
+          GetAllGoodInfoByID(params).then(response => {
451
+            if (response.data.state == 0) {
452
+              this.$message.error(response.data.msg)
453
+              return false
454
+            } else {
455
+              if (response.data.data.goodInfo.length == 0) {
456
+                this.$message.error('该厂商没商品,请添加商品')
457
+              } else {
458
+                for (let i = 0; i < response.data.data.goodInfo.length; i++) {
459
+                  this.propForm.goodType.push(response.data.data.goodInfo[i].GoodsType)
460
+                }
461
+
462
+                const obj = {}
463
+                this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
464
+                  obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
465
+                  return cur
466
+                }, []) // 设置cur默认类型为数组,并且初始值为空的数组
467
+              }
468
+            }
469
+          })
470
+        }
471
+      }, getSummaries(param) {
472
+        const { columns, data } = param
473
+        const sums = []
474
+        columns.forEach((column, index) => {
475
+          if (index === 0) {
476
+            sums[index] = '总价'
477
+            return
478
+          }
479
+          const values = data.map(item => Number(item[column.property]))
480
+          if (!values.every(value => isNaN(value))) {
481
+            sums[index] = values.reduce((prev, curr) => {
482
+              const value = Number(curr)
483
+              if (!isNaN(value)) {
484
+                return prev + curr
485
+              } else {
486
+                return prev
487
+              }
488
+            }, 0)
489
+            sums[index] += ' 元'
490
+          } else {
491
+            sums[index] = 'N/A'
492
+          }
493
+        })
494
+
495
+        return sums
496
+      }, back() {
497
+        this.$router.go(-1)
498
+      }, submit() {
499
+        this.$refs['tableForm'].validate((valid) => {
500
+          if (valid) {
501
+            if (this.form.manufacturer == 0) {
502
+              this.$message.error('厂商不能为空')
503
+              return
504
+            }
505
+            const array = this.recordInfo.recordData
506
+            for (let i = 0; i < array.length; i++) {
507
+              if (array[i].good_type_id == 0) {
508
+                this.$message.error('物品类型不能为空')
509
+                return
510
+              }
511
+              if (array[i].good_id == 0) {
512
+                this.$message.error('规格名称不能为空')
513
+                return
514
+              }
515
+            }
516
+
517
+            const params = {
518
+              'stockIn': this.recordInfo.recordData
519
+            }
520
+            postWarehouse(params, this.warehousing_time, this.form.manufacturer, this.form.dealer).then(response => {
521
+              if (response.data.state == 0) {
522
+                this.$message.error(response.data.msg)
523
+                return false
524
+              } else {
525
+                this.$notify({
526
+                  title: '成功',
527
+                  message: '入库成功',
528
+                  type: 'success',
529
+                  duration: 2000
530
+                })
531
+                this.$router.back(-1)
532
+              }
533
+            })
534
+          } else {
535
+            return false
536
+          }
537
+        })
538
+      }
539
+    },
540
+    created() {
541
+      var year = new Date().getFullYear()
542
+      var month = new Date().getMonth() + 1
543
+      var day = new Date().getDate()
544
+      if (parseInt(month) < 10) {
545
+        month = '0' + month
546
+      }
547
+      if (parseInt(day) < 10) {
548
+        day = '0' + day
549
+      }
550
+      const endTime = year + '-' + month + '-' + day
551
+      this.warehousing_time = endTime
552
+
553
+      const tempObj = {}
554
+      tempObj['good_type_id'] = 0
555
+      tempObj['good_id'] = 0
556
+      tempObj['number'] = ''
557
+      tempObj['product_date'] = ''
558
+      tempObj['expiry_date'] = ''
559
+      tempObj['warehousing_count'] = ''
560
+      tempObj['price'] = ''
561
+      tempObj['remark'] = ''
562
+      tempObj['dealer'] = ''
563
+      tempObj['manufacturer'] = ''
564
+
565
+      this.recordInfo.recordData.push(tempObj)
566
+      this.GetConfigInfo()
567
+      this.propForm.goodUnit = this.$store.getters.good_unit
568
+    }
569
+
570
+  }
571
+</script>
572
+
573
+<style rel="stylesheet/css" lang="scss" scoped>
574
+  .information {
575
+    border: 1px #dcdfe6 solid;
576
+    padding: 30px 20px 30px 20px;
577
+
578
+  .border {
579
+    border-bottom: 1px #dcdfe6 solid;
580
+    margin: 0px 0 20px 0;
581
+  }
582
+  }
583
+
584
+  .title {
585
+    background: #409eff;
586
+    height: 44px;
587
+    line-height: 44px;
588
+    padding: 0 0 0 10px;
589
+    color: #fff;
590
+    margin: 0 0 10px 0;
591
+  // border-radius: 4px 4px 0 0;
592
+  }
593
+
594
+  .edit_separater {
595
+    border-top: 1px solid rgb(233, 233, 233);
596
+    margin-top: 15px;
597
+    margin-bottom: 15px;
598
+  }
599
+
600
+</style>
601
+
602
+<style>
603
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
604
+    font-size: 12px;
605
+  }
606
+
607
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
608
+    background: #6fb5fa;
609
+  }
610
+
611
+</style>

+ 281 - 0
src/xt_pages/stock/stockInOrderDetail.vue Целия файл

@@ -0,0 +1,281 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <div class="filter-container">
6
+      <span style="font-size: 20px">耗材入库单详情</span>
7
+      <el-row style="float:right;">
8
+        <span>{{WarehouseInfo.warehouse.warehousing_order}}</span>
9
+      </el-row>
10
+    </div>
11
+
12
+
13
+
14
+    <div class="filter-container">
15
+      <span>单据日期:  {{WarehouseInfo.warehouse.warehousing_time | parseTime('{y}-{m}-{d}')}} </span>
16
+      <span>厂商 {{getManufactuerName(WarehouseInfo.warehouse.manufacturer)}}</span>
17
+      <span>经销商 {{getDealerName(WarehouseInfo.warehouse.dealer)}}</span>
18
+    </div>
19
+
20
+    <div class="filter-container" style="margin-top: 10px">
21
+      <el-button size="small" icon="el-icon-edit" @click="editRecord">编辑</el-button>
22
+      <el-button size="small" icon="el-icon-delete" @click="deleteRecord">删除</el-button>
23
+    </div>
24
+
25
+    <el-row :gutter="12" style="margin-top: 10px">
26
+      <el-table :data="WarehouseInfo.warehouseInfoDate" :class="signAndWeighBoxPatients" style="width: 100%" border
27
+      >
28
+        <el-table-column min-width="35" align="center">
29
+          <template slot="header" slot-scope="scope">
30
+            <span>物品类型</span>
31
+          </template>
32
+
33
+          <template slot-scope="scope">
34
+            <span v-if="scope.row.good_type_id != 0">{{getTypeName(scope.row.good_type_id)}}</span>
35
+          </template>
36
+        </el-table-column>
37
+        <el-table-column min-width="35" align="center">
38
+          <template slot="header" slot-scope="scope">
39
+            <span>规格名称</span>
40
+          </template>
41
+          <template slot-scope="scope">
42
+            <span v-if="scope.row.good_id != 0">{{getSpecificationName(scope.row.good_id)}}</span>
43
+          </template>
44
+        </el-table-column>
45
+
46
+
47
+        <el-table-column min-width="23" align="center">
48
+          <template slot="header" slot-scope="scope">
49
+            <span>单价</span>
50
+          </template>
51
+          <template slot-scope="scope">
52
+            <span>{{scope.row.price}}</span>
53
+          </template>
54
+        </el-table-column>
55
+
56
+        <el-table-column min-width="23" align="center">
57
+          <template slot="header" slot-scope="scope">
58
+            <span>入库数量</span>
59
+          </template>
60
+          <template slot-scope="scope">
61
+            <span>{{scope.row.warehousing_count}}</span>
62
+
63
+          </template>
64
+        </el-table-column>
65
+
66
+        <el-table-column label="总价" min-width="20" align="center">
67
+          <template slot-scope="scope">
68
+            {{calculate(scope.row.price*scope.row.warehousing_count)}}
69
+          </template>
70
+        </el-table-column>
71
+
72
+        <el-table-column align="center" min-width="25">
73
+          <template slot="header" slot-scope="scope">
74
+            <span>批号</span>
75
+          </template>
76
+          <template slot-scope="scope">
77
+            <span>{{scope.row.number}}</span>
78
+          </template>
79
+        </el-table-column>
80
+        <el-table-column label="生产日期" min-width="40" align="center">
81
+          <template slot-scope="scope">
82
+            {{scope.row.product_date | parseTime('{y}-{m}-{d}')}}
83
+
84
+          </template>
85
+        </el-table-column>
86
+        <el-table-column label="有效日期" min-width="40" align="center">
87
+          <template slot-scope="scope">
88
+            {{ scope.row.expiry_date | parseTime('{y}-{m}-{d}')}}
89
+          </template>
90
+        </el-table-column>
91
+        <el-table-column label="备注" min-width="20"  align="center">
92
+          <template slot-scope="scope">
93
+            <el-popover placement="top-start"  width="250" trigger="hover" >
94
+              <div>{{scope.row.remark}}</div>
95
+              <span slot="reference" v-if="scope.row.remark.length > 20">{{ scope.row.remark.substr(0,20)+'...' }}</span>
96
+              <span slot="reference" v-else>{{ scope.row.remark}}</span>
97
+            </el-popover>
98
+
99
+          </template>
100
+        </el-table-column>
101
+      </el-table>
102
+    </el-row>
103
+  </div>
104
+</template>
105
+
106
+<script>
107
+  import { uParseTime } from '@/utils/tools'
108
+  import { GetAllConfig, getWarehouseInfoList, deleteWarehouseInfo } from '@/api/stock'
109
+
110
+  export default {
111
+    name: 'stockInOrderDetail',
112
+    created() {
113
+      const order_id = this.$route.query.id
114
+      this.GetConfigInfo()
115
+      this.GetOrderDetail(order_id)
116
+    },
117
+    data() {
118
+      return {
119
+        isEdit: 0,
120
+        checked: false,
121
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
122
+        goodType: [],
123
+        goodInfo: [],
124
+        manufacturer: [],
125
+        dealer: [],
126
+        Warehouse: {
127
+          loading: false,
128
+          warehouseDate: [],
129
+          tableCurrentIndex: ''
130
+        },
131
+
132
+        WarehouseInfo: {
133
+          loading: false,
134
+          warehouseInfoDate: [],
135
+          warehouse: {}
136
+        }
137
+      }
138
+    },
139
+    methods: {
140
+      getSpecificationName: function(id) {
141
+        let name = ''
142
+        for (let i = 0; i < this.goodInfo.length; i++) {
143
+          if (this.goodInfo[i].id == id) {
144
+            name = this.goodInfo[i].specification_name
145
+          }
146
+        }
147
+        return name
148
+      }, getTypeName: function(id) {
149
+        let name = ''
150
+        for (let i = 0; i < this.goodType.length; i++) {
151
+          if (this.goodType[i].id == id) {
152
+            name = this.goodType[i].type_name
153
+          }
154
+        }
155
+        return name
156
+      }, GetConfigInfo: function() {
157
+        GetAllConfig().then(response => {
158
+          if (response.data.state == 0) {
159
+            this.$message.error(response.data.msg)
160
+            return false
161
+          } else {
162
+            this.manufacturer = response.data.data.manufacturer
163
+            this.dealer = response.data.data.dealer
164
+            this.goodInfo = response.data.data.goodInfo
165
+            this.goodType = response.data.data.goodType
166
+          }
167
+        })
168
+      }, getManufactuerName: function(manufacturer_id) {
169
+        for (let i = 0; i < this.manufacturer.length; i++) {
170
+          if (this.manufacturer[i].id == manufacturer_id) {
171
+            return this.manufacturer[i].manufacturer_name
172
+          }
173
+        }
174
+      }, getDealerName: function(dealer_id) {
175
+        for (let i = 0; i < this.dealer.length; i++) {
176
+          if (this.dealer[i].id == dealer_id) {
177
+            return this.dealer[i].dealer_name
178
+          }
179
+        }
180
+      }, calculate: function(val) {
181
+        if (val == 0) {
182
+          return ''
183
+        }
184
+        return Math.round(parseFloat(val) * 100) / 100
185
+      }, GetOrderDetail: function(order_id) {
186
+        const params = {
187
+          'id': order_id
188
+        }
189
+        getWarehouseInfoList(params).then(response => {
190
+          if (response.data.state == 0) {
191
+            this.$message.error(response.data.msg)
192
+            return false
193
+          } else {
194
+            for (let i = 0; i < response.data.data.info.length; i++) {
195
+              this.WarehouseInfo.warehouseInfoDate.push(response.data.data.info[i])
196
+            }
197
+            this.WarehouseInfo.warehouse = response.data.data.warehousing
198
+          }
199
+        })
200
+      }, deleteRecord: function() {
201
+        const ids = []
202
+        ids.push(this.WarehouseInfo.warehouse.id)
203
+        const idStr = ids.join(',')
204
+
205
+        const params = {
206
+          ids: idStr
207
+        }
208
+
209
+        this.$confirm('确认删除入库单记录?', '删除入库单记录', {
210
+          confirmButtonText: '确定',
211
+          cancelButtonText: '取消',
212
+          type: 'warning'
213
+        }).then(() => {
214
+          deleteWarehouseInfo(params).then(response => {
215
+            if (response.data.state == 0) {
216
+              this.$message.error(response.data.msg)
217
+              return false
218
+            } else {
219
+              this.$notify({
220
+                title: '成功',
221
+                message: '删除成功',
222
+                type: 'success',
223
+                duration: 2000
224
+              })
225
+
226
+              this.$router.back(-1)
227
+            }
228
+          })
229
+        }).catch(() => {
230
+        })
231
+      }, editRecord: function() {
232
+        this.$emit('edit-record')
233
+      }
234
+    }
235
+  }
236
+</script>
237
+
238
+<style rel="stylesheet/css" lang="scss" scoped>
239
+  .information {
240
+    border: 1px #dcdfe6 solid;
241
+    padding: 30px 20px 30px 20px;
242
+
243
+  .border {
244
+    border-bottom: 1px #dcdfe6 solid;
245
+    margin: 0px 0 20px 0;
246
+  }
247
+
248
+  }
249
+
250
+  .title {
251
+    background: #409eff;
252
+    height: 44px;
253
+    line-height: 44px;
254
+    padding: 0 0 0 10px;
255
+    color: #fff;
256
+    margin: 0 0 10px 0;
257
+  }
258
+
259
+  .edit_separater {
260
+    border-top: 1px solid rgb(233, 233, 233);
261
+    margin-top: 15px;
262
+    margin-bottom: 15px;
263
+  }
264
+
265
+</style>
266
+
267
+<style>
268
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
269
+    font-size: 12px;
270
+  }
271
+
272
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
273
+    background: #6fb5fa;
274
+  }
275
+
276
+  .count {
277
+    color: #bd2c00;
278
+
279
+  }
280
+
281
+</style>

+ 502 - 0
src/xt_pages/stock/stockInOrderEdit.vue Целия файл

@@ -0,0 +1,502 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <sales-return-dialog :propForm="propForm"
6
+                     :visibility="isVisibility"
7
+                     v-on:dialog-comfirm="comfirm"
8
+                     v-on:dialog-cancle="cancle"></sales-return-dialog>
9
+
10
+    <div class="filter-container">
11
+
12
+      <el-row>
13
+        <el-col :span="8"><div>
14
+          <span>入库时间:</span>
15
+          <el-date-picker v-model="warehousing_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
16
+                          type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
17
+                          value-format="yyyy-MM-dd"></el-date-picker>
18
+        </div></el-col>
19
+      </el-row>
20
+    </div>
21
+
22
+    <el-row>
23
+      <el-col>
24
+        <el-form  :rules="tableRules" :model="recordInfo" ref="tableForm">
25
+          <el-table :data="recordInfo.recordData" :class="signAndWeighBoxPatients" style="width: 100%" border
26
+                    max-height="450"
27
+          >
28
+
29
+            <el-table-column label="操作" align="center" min-width="30">
30
+              <template slot-scope="scope">
31
+                <el-button
32
+                  size="mini"
33
+                  @click="handleEdit(scope.$index, scope.row)">+
34
+                </el-button>
35
+                <el-button
36
+                  size="mini"
37
+                  type="danger"
38
+                  @click="handleDelete(scope.$index, scope.row)">-
39
+                </el-button>
40
+              </template>
41
+            </el-table-column>
42
+
43
+            <el-table-column min-width="35" align="center">
44
+
45
+              <template slot="header" slot-scope="scope">
46
+                <span>物品类型<span style="color: red">*</span></span>
47
+              </template>
48
+
49
+              <template slot-scope="scope" >
50
+                <!--<span @click="showDialog(scope.$index, scope.row)" v-if="scope.row.good_type_id == 0" style="color:#c5c8cf">请输入类型</span>-->
51
+                <!--<span @click="showDialog(scope.$index, scope.row)" v-if="scope.row.good_type_id != 0">{{typeName(scope.row.good_type_id)}}</span>-->
52
+
53
+                <el-form-item  style="padding-top: 15px">
54
+                  <el-input placeholder="请输入物品类型"  v-model="scope.row.good_type_id" :value="typeName(scope.row.good_type_id)" @focus="showDialog(scope.$index, scope.row)" ></el-input>
55
+                </el-form-item>
56
+
57
+              </template>
58
+            </el-table-column>
59
+            <el-table-column min-width="35" align="center">
60
+              <template slot="header" slot-scope="scope">
61
+                <span>规格名称<span style="color: red">*</span></span>
62
+              </template>
63
+              <template slot-scope="scope">
64
+
65
+                <el-form-item  style="padding-top: 15px">
66
+                  <el-input placeholder="请输入规格名称"  v-model="scope.row.good_id" :value="specificationName(scope.row.good_id)" @focus="showDialog(scope.$index, scope.row)" ></el-input>
67
+                </el-form-item>
68
+
69
+              </template>
70
+            </el-table-column>
71
+
72
+
73
+            <el-table-column  min-width="23" align="center">
74
+              <template slot="header" slot-scope="scope">
75
+                <span>单价<span style="color: red">*</span></span>
76
+              </template>
77
+              <template slot-scope="scope">
78
+                <!--<el-input type="number" v-model="scope.row.price"  @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
79
+                <el-form-item :prop="'recordData.' + scope.$index + '.price'" :rules='tableRules.price' style="padding-top: 17px">
80
+                  <el-input type="number"  v-model="scope.row.price" ></el-input>
81
+                </el-form-item>
82
+
83
+
84
+
85
+
86
+              </template>
87
+            </el-table-column>
88
+
89
+            <el-table-column  min-width="23" align="center">
90
+              <template slot="header" slot-scope="scope">
91
+                <span>入库数量<span style="color: red">*</span></span>
92
+              </template>
93
+              <template slot-scope="scope">
94
+                <!--{{scope.row.warehousing_count}}-->
95
+                <!--<el-input type="number" v-model="scope.row.warehousing_count"   @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
96
+
97
+                <el-form-item :prop="'recordData.' + scope.$index + '.warehousing_count'" :rules='tableRules.warehousing_count' style="padding-top: 17px">
98
+                  <el-input type="number"  v-model="scope.row.warehousing_count" ></el-input>
99
+                </el-form-item>
100
+              </template>
101
+            </el-table-column>
102
+
103
+            <el-table-column label="总价" min-width="20" align="center">
104
+              <template slot-scope="scope">
105
+                {{calculate(scope.row.price*scope.row.warehousing_count)}}
106
+              </template>
107
+            </el-table-column>
108
+
109
+            <el-table-column  align="center" min-width="25">
110
+              <template slot="header" slot-scope="scope">
111
+                <span>批号<span style="color: red">*</span></span>
112
+              </template>
113
+              <template slot-scope="scope">
114
+                <!--<el-input  v-model="scope.row.numbers"></el-input>-->
115
+
116
+                <el-form-item :prop="'recordData.' + scope.$index + '.number'" :rules='tableRules.number' style="padding-top: 17px">
117
+                  <el-input  v-model="scope.row.number" ></el-input>
118
+                </el-form-item>
119
+
120
+              </template>
121
+            </el-table-column>
122
+            <el-table-column label="生产日期" min-width="40" align="center">
123
+              <template slot-scope="scope" >
124
+                <!--{{scope.row.product_date | parseTime("{y}-{m}-{d}")}}-->
125
+                <el-date-picker prefix-icon="el-icon-date" style="width: 145px" v-model="scope.row.product_date"
126
+                                type="date" placeholder="选择日期时间" format="yyyy-MM-dd"
127
+                                value-format="yyyy-MM-dd"></el-date-picker>
128
+
129
+              </template>
130
+            </el-table-column>
131
+            <el-table-column label="有效日期" min-width="40" align="center">
132
+              <template slot-scope="scope">
133
+                <!--{{ scope.row.expiry_date | parseTime("{y}-{m}-{d}")}}-->
134
+                <el-date-picker  prefix-icon="el-icon-date" style="width: 145px" v-model="scope.row.expiry_date"
135
+                                 type="date" placeholder="选择日期时间"  format="yyyy-MM-dd"
136
+                                 value-format="yyyy-MM-dd"></el-date-picker>
137
+
138
+              </template>
139
+            </el-table-column>
140
+            <el-table-column label="备注" min-width="20" align="center">
141
+              <template slot-scope="scope">
142
+                <el-input  v-model="scope.row.remark"></el-input>
143
+              </template>
144
+            </el-table-column>
145
+          </el-table>
146
+        </el-form>
147
+      </el-col>
148
+
149
+
150
+      <span  class="dialog-footer" style="margin-top: 20px;float:right">
151
+        <el-button @click="back()">取 消</el-button>
152
+        <el-button type="primary" @click="submit()">确 定</el-button>
153
+      </span>
154
+
155
+    </el-row>
156
+  </div>
157
+</template>
158
+
159
+<script>
160
+  import stockInDialog from './Dialog/stockInDialog'
161
+  import { uParseTime } from '@/utils/tools'
162
+
163
+import {
164
+  GetAllConfig,
165
+  getWarehouseInfoList,
166
+  GetAllGoodInfoByID,
167
+  getWarehouseInfoByOrdeNumber,
168
+  modifyWarehouseInfo,
169
+  deleteWarehouseInfo,
170
+  DeleteWarehouseInfoItem,
171
+  EditWarehouse
172
+  } from '@/api/stock'
173
+  import SalesReturnDialog from './Dialog/salesReturnDialog'
174
+
175
+export default {
176
+    components: { SalesReturnDialog, stockInDialog },
177
+    name: 'stockIn',
178
+
179
+    data() {
180
+      var checkGoodId = (rule, value, callback) => {
181
+        setTimeout(() => {
182
+          if (value == '' || value == 0) {
183
+            return callback(new Error('规格名称不能为空'))
184
+          }
185
+        }, 2000)
186
+      }
187
+
188
+      return {
189
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
190
+        warehousing_time: '',
191
+        adminUserOptions: null,
192
+        currentIndex: 0,
193
+
194
+        recordInfo: {
195
+          recordData: [],
196
+          stock_in_code: '',
197
+          current_index: ''
198
+
199
+        },
200
+        tableRules: {
201
+          price: [
202
+            { required: true, message: '单价不能为空', trigger: 'blur' }
203
+          ],
204
+          warehousing_count: [
205
+            { required: true, message: '数量不能为空', trigge: 'blur' }
206
+          ],
207
+          number: [
208
+            { required: true, message: '批号不能为空', trigge: 'blur' }
209
+          ],
210
+          good_id: [
211
+            { validator: checkGoodId, trigger: 'blur' }
212
+          ]
213
+
214
+        },
215
+        ruleForm: {
216
+          manufacturer: [
217
+            { required: true, message: '请选择厂商', trigger: 'change' }
218
+          ]
219
+
220
+        },
221
+
222
+        total: '',
223
+        product_date: '',
224
+        expiry_date: '',
225
+        numbers: '',
226
+        // prop
227
+        isVisibility: false,
228
+        propForm: {
229
+          goodType: [],
230
+          goodInfo: [],
231
+          goodUnit: [],
232
+          title: '入库',
233
+          isCreated: 1
234
+
235
+        },
236
+
237
+        form: {
238
+          manufacturer: '',
239
+          dealer: ''
240
+        },
241
+        warehouse: {},
242
+        manufacturer: [],
243
+        dealer: [],
244
+        goodType: []
245
+      }
246
+  },
247
+    methods: {
248
+      comfirm: function(val) {
249
+        this.isVisibility = false
250
+        if (val.selectedGoodInfo.length > 0) {
251
+          for (let i = val.selectedGoodInfo.length - 1; ;i--) {
252
+            if (i == 0) {
253
+              this.recordInfo.recordData[this.currentIndex].good_type_id = val.goodTypeId
254
+              this.recordInfo.recordData[this.currentIndex].good_id = val.selectedGoodInfo[i].id
255
+            } else {
256
+              const tempForm = {}
257
+              tempForm['id'] = 0
258
+              tempForm['good_type_id'] = val.goodTypeId
259
+              tempForm['good_id'] = val.selectedGoodInfo[i].id
260
+              tempForm['number'] = ''
261
+              tempForm['product_date'] = ''
262
+              tempForm['expiry_date'] = ''
263
+              tempForm['warehousing_count'] = ''
264
+              tempForm['price'] = ''
265
+              tempForm['remark'] = ''
266
+              tempForm['dealer'] = ''
267
+              tempForm['manufacturer'] = ''
268
+              this.recordInfo.recordData.push(tempForm)
269
+            }
270
+          }
271
+        }
272
+
273
+        this.currentIndex = -1
274
+      }, cancle: function() {
275
+        this.isVisibility = false
276
+      },  GetConfigInfo: function() {
277
+        GetAllConfig().then(response => {
278
+          if (response.data.state == 0) {
279
+            this.$message.error(response.data.msg)
280
+            return false
281
+          } else {
282
+            this.manufacturer = response.data.data.manufacturer
283
+            this.dealer = response.data.data.dealer
284
+            this.goodType = response.data.data.goodType
285
+            this.goodInfo = response.data.data.goodInfo
286
+          }
287
+        })
288
+
289
+      }, typeName: function(good_type_id) {
290
+        let name = '请输入物品类型'
291
+        for (let i = 0; i < this.goodType.length; i++) {
292
+          if (this.goodType[i].id == good_type_id) {
293
+            name = this.goodType[i].type_name
294
+          }
295
+        }
296
+        return name
297
+      }, specificationName: function(good_info_id) {
298
+        let name = ''
299
+        for (let i = 0; i < this.goodInfo.length; i++) {
300
+          if (this.goodInfo[i].id == good_info_id) {
301
+            name = this.goodInfo[i].specification_name
302
+          }
303
+        }
304
+        return name
305
+      }, handleEdit: function(index, row) {
306
+        const tempObj = {}
307
+        tempObj['id'] = 0
308
+        tempObj['good_type_id'] = 0
309
+        tempObj['good_id'] = 0
310
+        tempObj['number'] = ''
311
+        tempObj['product_date'] = ''
312
+        tempObj['expiry_date'] = ''
313
+        tempObj['warehousing_count'] = ''
314
+        tempObj['price'] = ''
315
+        tempObj['remark'] = ''
316
+        tempObj['dealer'] = ''
317
+        tempObj['manufacturer'] = ''
318
+        this.recordInfo.recordData.push(tempObj)
319
+      }, handleDelete: function(index, row) {
320
+        if (row.id == 0) {
321
+          this.recordInfo.recordData.splice(index, 1)
322
+        } else {
323
+          const params = {
324
+            id: row.id
325
+          }
326
+          this.$confirm('确认删除该入库物品信息记录?', '删除入库物品信息记录', {
327
+            confirmButtonText: '确定',
328
+            cancelButtonText: '取消',
329
+            type: 'warning'
330
+          }).then(() => {
331
+            DeleteWarehouseInfoItem(params).then(response => {
332
+              if (response.data.state == 0) {
333
+                this.$message.error(response.data.msg)
334
+                return false
335
+              } else {
336
+                this.$notify({
337
+                  title: '成功',
338
+                  message: '删除成功',
339
+                  type: 'success',
340
+                  duration: 2000
341
+                })
342
+                this.recordInfo.recordData.splice(index, 1)
343
+              }
344
+            })
345
+          }).catch(() => {
346
+          })
347
+        }
348
+      }, calculate: function(val) {
349
+        if (val == 0) {
350
+          return ''
351
+        }
352
+        return Math.round(parseFloat(val) * 100) / 100
353
+      },  getTime(val, temp) {
354
+        if (val != 0) {
355
+          return uParseTime(val, temp)
356
+        } else {
357
+          return ''
358
+        }
359
+      }, showDialog(index, row) {
360
+        this.currentIndex = index
361
+        if (this.form.manufacturer == '' || this.form.manufacturer == 0) {
362
+          this.$message.error('请先选择厂商')
363
+          return
364
+        } else {
365
+          this.isVisibility = true
366
+          const params = {
367
+            id: this.form.manufacturer
368
+          }
369
+          GetAllGoodInfoByID(params).then(response => {
370
+            if (response.data.state == 0) {
371
+              this.$message.error(response.data.msg)
372
+              return false
373
+            } else {
374
+              if (response.data.data.goodInfo.length == 0) {
375
+                this.$message.error('该厂商没商品,请添加商品')
376
+              } else {
377
+                for (let i = 0; i < response.data.data.goodInfo.length; i++) {
378
+                  this.propForm.goodType.push(response.data.data.goodInfo[i].GoodsType)
379
+                }
380
+
381
+                const obj = {}
382
+                this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
383
+                  obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
384
+                  return cur
385
+                }, []) // 设置cur默认类型为数组,并且初始值为空的数组
386
+              }
387
+            }
388
+          })
389
+        }
390
+      }, back() {
391
+        this.$router.go(-1)
392
+      }, submit() {
393
+        this.$refs['tableForm'].validate((valid) => {
394
+          if (valid) {
395
+            const array = this.recordInfo.recordData
396
+            for (let i = 0; i < array.length; i++) {
397
+              if (array[i].good_type_id == 0) {
398
+                this.$message.error('物品类型不能为空')
399
+                return
400
+              }
401
+              if (array[i].good_id == 0) {
402
+                this.$message.error('规格名称不能为空')
403
+                return
404
+              }
405
+            }
406
+
407
+            const params = {
408
+              'stockIn': this.recordInfo.recordData
409
+            }
410
+            EditWarehouse(params, this.warehousing_time, this.$route.query.id).then(response => {
411
+              if (response.data.state == 0) {
412
+                this.$message.error(response.data.msg)
413
+                return false
414
+              } else {
415
+                this.$notify({
416
+                  title: '成功',
417
+                  message: '入库成功',
418
+                  type: 'success',
419
+                  duration: 2000
420
+                })
421
+                this.$router.back(-1)
422
+              }
423
+            })
424
+          } else {
425
+            return false
426
+          }
427
+        })
428
+      }, GetOrderDetail: function(order_id) {
429
+        const params = {
430
+          'id': order_id
431
+        }
432
+        getWarehouseInfoList(params).then(response => {
433
+          if (response.data.state == 0) {
434
+            this.$message.error(response.data.msg)
435
+            return false
436
+          } else {
437
+            for (let i = 0; i < response.data.data.info.length; i++) {
438
+              response.data.data.info[i].product_date = this.getTime(response.data.data.info[i].product_date, '{y}-{m}-{d}')
439
+              response.data.data.info[i].expiry_date = this.getTime(response.data.data.info[i].expiry_date, '{y}-{m}-{d}')
440
+              response.data.data.info[i].price = response.data.data.info[i].price.toString()
441
+              response.data.data.info[i].warehousing_count = response.data.data.info[i].warehousing_count.toString()
442
+
443
+              this.recordInfo.recordData.push(response.data.data.info[i])
444
+            }
445
+
446
+            this.warehouse = response.data.data.warehousing
447
+            this.form.manufacturer = this.warehouse.manufacturer
448
+            this.form.dealer = this.warehouse.dealer
449
+            this.warehousing_time = this.getTime(this.warehouse.warehousing_time, '{y}-{m}-{d}')
450
+          }
451
+        })
452
+      }
453
+    },
454
+    created() {
455
+      this.GetConfigInfo()
456
+      this.propForm.goodUnit = this.$store.getters.good_unit
457
+      const order_id = this.$route.query.id
458
+      this.GetOrderDetail(order_id)
459
+    }
460
+
461
+  }
462
+</script>
463
+
464
+<style rel="stylesheet/css" lang="scss" scoped>
465
+  .information {
466
+    border: 1px #dcdfe6 solid;
467
+    padding: 30px 20px 30px 20px;
468
+
469
+  .border {
470
+    border-bottom: 1px #dcdfe6 solid;
471
+    margin: 0px 0 20px 0;
472
+  }
473
+  }
474
+
475
+  .title {
476
+    background: #409eff;
477
+    height: 44px;
478
+    line-height: 44px;
479
+    padding: 0 0 0 10px;
480
+    color: #fff;
481
+    margin: 0 0 10px 0;
482
+   border-radius: 4px 4px 0 0;
483
+  }
484
+
485
+  .edit_separater {
486
+    border-top: 1px solid rgb(233, 233, 233);
487
+    margin-top: 15px;
488
+    margin-bottom: 15px;
489
+  }
490
+
491
+</style>
492
+
493
+<style>
494
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
495
+    font-size: 12px;
496
+  }
497
+
498
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
499
+    background: #6fb5fa;
500
+  }
501
+
502
+</style>

+ 24 - 0
src/xt_pages/stock/stockOutDetail.vue Целия файл

@@ -0,0 +1,24 @@
1
+<template>
2
+  <stock-out-order-detail v-if="isEdit == 0"   v-on:edit-record="isEdit = 1"></stock-out-order-detail>
3
+  <stock-out-edit v-else></stock-out-edit>
4
+</template>
5
+
6
+<script>
7
+  import StockOutOrderDetail from './stockOutOrderDetail'
8
+  import StockOutEdit from './stockOutOrderEdit'
9
+  export default {
10
+    name: 'stockInDeatail',
11
+    components: { StockOutEdit, StockOutOrderDetail},
12
+    data() {
13
+      return {
14
+        isEdit: 0
15
+      }
16
+    }
17
+
18
+  }
19
+
20
+</script>
21
+
22
+<style scoped>
23
+
24
+</style>

+ 406 - 0
src/xt_pages/stock/stockOutOrder.vue Целия файл

@@ -0,0 +1,406 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+
6
+    <div class="filter-container">
7
+
8
+
9
+      <el-row style="float:right;">
10
+        <el-button @click="AddNewOrder" type="primary">新增</el-button>
11
+      </el-row>
12
+    </div>
13
+
14
+    <div class="filter-container" style="margin-top:20px">
15
+      <el-input style="width: 300px;" class="filter-item" placeholder="单据日期/单据编码/制单人/供应商"/>
16
+      <el-button class="filter-item" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
17
+    </div>
18
+
19
+    <div class="filter-container">
20
+      <span>入库时间:</span>
21
+      <el-date-picker v-model="start_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
22
+                      type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
23
+                      value-format="yyyy-MM-dd" @change="startTimeChange"></el-date-picker>
24
+      <span class="">-</span>
25
+      <el-date-picker v-model="end_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
26
+                      type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
27
+                      value-format="yyyy-MM-dd" @change="endTimeChange"></el-date-picker>
28
+    </div>
29
+
30
+    <div class="filter-container" style="margin-top: 10px">
31
+      <el-checkbox style="width: 30px" v-model="checked" @change="changeAllSelected">全选</el-checkbox>
32
+      <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
33
+
34
+    </div>
35
+
36
+    <el-row :gutter="12" style="margin-top: 10px">
37
+      <el-table
38
+        :data="warehouseOutDate"
39
+        :class="signAndWeighBoxPatients"
40
+        style="width: 100%" border
41
+        highlight-current-row
42
+        ref="multipleTable"
43
+        @selection-change="select"
44
+
45
+      >
46
+        <el-table-column
47
+          type="selection"
48
+          width="55">
49
+        </el-table-column>
50
+
51
+        <el-table-column label="单据日期" align="center">
52
+          <template slot-scope="scope">
53
+            {{ scope.row.warehouse_out_time | parseTime('{y}-{m}-{d}')}}
54
+          </template>
55
+        </el-table-column>
56
+
57
+        <el-table-column label="单据编号" align="center">
58
+          <template slot-scope="scope">
59
+            {{scope.row.warehouse_out_order_number}}
60
+          </template>
61
+        </el-table-column>
62
+
63
+        <el-table-column label="制单人" align="center">
64
+          <template slot-scope="scope">
65
+            {{getXuserName(scope.row.creater)}}
66
+          </template>
67
+        </el-table-column>
68
+
69
+
70
+        <el-table-column label="厂家" align="center">
71
+          <template slot-scope="scope">
72
+            {{getManufactuerName(scope.row.manufacturer)}}
73
+          </template>
74
+        </el-table-column>
75
+
76
+        <el-table-column label="经销商" align="center">
77
+          <template slot-scope="scope">
78
+            {{getDealerName(scope.row.dealer)}}
79
+          </template>
80
+        </el-table-column>
81
+
82
+        <el-table-column label="操作" align="center">
83
+          <template slot-scope="scope">
84
+            <el-button
85
+              size="mini"
86
+              type="primary"
87
+              icon="el-icon-edit"
88
+              @click="handleEdit(scope.$index, scope.row)">
89
+            </el-button>
90
+
91
+            <el-button
92
+              size="mini"
93
+              type="danger"
94
+              icon="el-icon-delete"
95
+              @click="handleDelete(scope.$index, scope.row)">
96
+            </el-button>
97
+
98
+          </template>
99
+        </el-table-column>
100
+
101
+      </el-table>
102
+
103
+      <el-pagination
104
+        @size-change="handleSizeChange"
105
+        @current-change="handleCurrentChange"
106
+        :page-sizes="[7]"
107
+        :page-size="7"
108
+        background
109
+        style="margin-top:20px;float: right"
110
+        layout="total, sizes, prev, pager, next, jumper"
111
+        :total="total">
112
+      </el-pagination>
113
+
114
+    </el-row>
115
+  </div>
116
+</template>
117
+
118
+<script>
119
+  import { uParseTime } from '@/utils/tools'
120
+  import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from '@/api/doctor'
121
+  import {
122
+    deleteWarehouseOut,
123
+    GetAllConfig,
124
+    getWarehouseOutList,
125
+  } from '@/api/stock'
126
+
127
+  export default {
128
+    name: 'salesReturnOrder',
129
+    created() {
130
+      var year = new Date().getFullYear()
131
+      var month = new Date().getMonth() + 1
132
+      var day = new Date().getDate()
133
+      if (parseInt(month) < 10) {
134
+        month = '0' + month
135
+      }
136
+      if (parseInt(day) < 10) {
137
+        day = '0' + day
138
+      }
139
+      const endTime = year + '-' + month + '-' + day
140
+      this.end_time = endTime
141
+
142
+      var year = new Date().getFullYear()
143
+      var month = new Date().getMonth()
144
+      var day = new Date().getDate()
145
+      if (parseInt(month) < 10) {
146
+        month = '0' + month
147
+      }
148
+      if (parseInt(day) < 10) {
149
+        day = '0' + day
150
+      }
151
+      const startTime = year + '-' + month + '-' + day
152
+      this.start_time = startTime
153
+      this.GetWarehouseOut()
154
+      this.GetConfigInfo()
155
+      this.fetchAllAdminUsers()
156
+    },
157
+    data() {
158
+      return {
159
+        page: 1,
160
+        limit: 7,
161
+        checked: false,
162
+        total: 0,
163
+        pageTotal: 0,
164
+        pageSelect: 0,
165
+        adminUserOptions: [],
166
+        multipleSelection: [],
167
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
168
+        start_time: '',
169
+        warehouseOutDate: [],
170
+        end_time: '',
171
+        goodType: [],
172
+        goodInfo: [],
173
+        manufacturer: [],
174
+        selectedTableData: [],
175
+        dealer: [],
176
+
177
+      }
178
+    },
179
+    methods: {
180
+      AddNewOrder:function(){
181
+        this.$router.push({ name: 'stockOutOrderAdd'})
182
+      },
183
+      GetWarehouseOut: function() {
184
+        const Params = {
185
+          page: this.page,
186
+          limit: this.limit,
187
+          start_time: this.start_time,
188
+          end_time: this.end_time
189
+        }
190
+        this.warehouseOutDate = []
191
+        getWarehouseOutList(Params).then(response => {
192
+          if (response.data.state == 0) {
193
+            this.$message.error(response.data.msg)
194
+            return false
195
+          } else {
196
+            this.total = response.data.data.total
197
+            for (let i = 0; i < response.data.data.list.length; i++) {
198
+              this.warehouseOutDate.push(response.data.data.list[i])
199
+            }
200
+          }
201
+        })
202
+      }, getXuserName(id) {
203
+        if (id <= 0) {
204
+          return ''
205
+        }
206
+        var name = ''
207
+        if (this.adminUserOptions == null || typeof (this.adminUserOptions.length) === 'undefined') {
208
+          return name
209
+        }
210
+        var leng = this.adminUserOptions.length
211
+        if (leng == 0) {
212
+          return name
213
+        }
214
+        for (let index = 0; index < leng; index++) {
215
+          if (this.adminUserOptions[index].id == id) {
216
+            name = this.adminUserOptions[index].name
217
+            break
218
+          }
219
+        }
220
+        return name
221
+      }, fetchAllAdminUsers() {
222
+        fetchAllAdminUsers().then(response => {
223
+          console.log(response)
224
+          if (response.data.state == 1) {
225
+            this.adminUserOptions = response.data.data.users
226
+            var alen = this.adminUserOptions.length
227
+            for (let index = 0; index < alen; index++) {
228
+              if (this.adminUserOptions[index].user_type == 2) {
229
+                // this.doctorOptions.push(this.adminUserOptions[index]);
230
+              }
231
+            }
232
+          }
233
+        })
234
+      }, handleSelectionChange: function(val) {
235
+        this.multipleSelection = val
236
+      }, handleSizeChange(val) {
237
+        this.limit = val
238
+        this.GetWarehouse()
239
+      }, handleCurrentChange(val) {
240
+        this.page = val
241
+        this.GetWarehouse()
242
+      }, startTimeChange(val) {
243
+        this.GetWarehouse()
244
+      }, endTimeChange(val) {
245
+        this.GetWarehouse()
246
+      }, calculate: function(val) {
247
+        return Math.round(parseFloat(val) * 100) / 100
248
+      }, GetConfigInfo: function() {
249
+        GetAllConfig().then(response => {
250
+          if (response.data.state == 0) {
251
+            this.$message.error(response.data.msg)
252
+            return false
253
+          } else {
254
+            this.manufacturer = response.data.data.manufacturer
255
+            this.dealer = response.data.data.dealer
256
+          }
257
+        })
258
+      }, getManufactuerName: function(manufacturer_id) {
259
+        for (let i = 0; i < this.manufacturer.length; i++) {
260
+          if (this.manufacturer[i].id == manufacturer_id) {
261
+            return this.manufacturer[i].manufacturer_name
262
+          }
263
+        }
264
+      }, getDealerName: function(dealer_id) {
265
+        for (let i = 0; i < this.dealer.length; i++) {
266
+          if (this.dealer[i].id == dealer_id) {
267
+            return this.dealer[i].dealer_name
268
+          }
269
+        }
270
+      }, handleEdit: function(index, row) {
271
+        this.$router.push({ name: 'stockOutDetail', query: { id: row.id }})
272
+      }, handleDelete: function(index, row) {
273
+        const ids = []
274
+        ids.push(row.id)
275
+        const idStr = ids.join(',')
276
+
277
+        const params = {
278
+          ids: idStr
279
+        }
280
+
281
+        this.$confirm('确认删除退货单记录?', '删除退货单记录', {
282
+          confirmButtonText: '确定',
283
+          cancelButtonText: '取消',
284
+          type: 'warning'
285
+        }).then(() => {
286
+          deleteWarehouseOut(params).then(response => {
287
+            if (response.data.state == 0) {
288
+              this.$message.error(response.data.msg)
289
+              return false
290
+            } else {
291
+              this.$notify({
292
+                title: '成功',
293
+                message: '删除成功',
294
+                type: 'success',
295
+                duration: 2000
296
+              })
297
+              for (let i = 0; i < ids.length; i++) {
298
+                for (let y = 0; y < this.warehouseOutDate.length; y++) {
299
+                  if (ids[i] == this.warehouseOutDate[y].id) {
300
+                    this.warehouseOutDate.splice(y, 1)
301
+                  }
302
+                }
303
+              }
304
+            }
305
+          })
306
+        }).catch(() => {
307
+        })
308
+      }, changeAllSelected: function(val) {
309
+        if (val) {
310
+          this.$refs.multipleTable.toggleAllSelection()
311
+        } else {
312
+          this.$refs.multipleTable.clearSelection()
313
+        }
314
+      }, select(selection) {
315
+        this.selectedTableData = selection
316
+      }, batchDelete() {
317
+        if (this.selectedTableData.length <= 0) {
318
+          this.$message.error('请选择要删除的记录')
319
+          return
320
+        }
321
+        const ids = []
322
+        for (let i = 0; i < this.selectedTableData.length; i++) {
323
+          ids.push(this.selectedTableData[i].id)
324
+        }
325
+        const idStr = ids.join(',')
326
+        const params = {
327
+          ids: idStr
328
+        }
329
+        this.$confirm('确认删除退货单记录?', '删除退货单记录', {
330
+          confirmButtonText: '确定',
331
+          cancelButtonText: '取消',
332
+          type: 'warning'
333
+        }).then(() => {
334
+          deleteWarehouseOut(params).then(response => {
335
+            if (response.data.state == 0) {
336
+              this.$message.error(response.data.msg)
337
+              return false
338
+            } else {
339
+              this.$notify({
340
+                title: '成功',
341
+                message: '删除成功',
342
+                type: 'success',
343
+                duration: 2000
344
+              })
345
+
346
+              for (let i = 0; i < ids.length; i++) {
347
+                for (let y = 0; y < this.warehouseOutDate.length; y++) {
348
+                  if (ids[i] == this.warehouseOutDate[y].id) {
349
+                    this.warehouseOutDate.splice(y, 1)
350
+                  }
351
+                }
352
+              }
353
+            }
354
+          })
355
+        }).catch(() => {
356
+        })
357
+      }
358
+    }
359
+  }
360
+</script>
361
+
362
+<style rel="stylesheet/css" lang="scss" scoped>
363
+  .information {
364
+    border: 1px #dcdfe6 solid;
365
+    padding: 30px 20px 30px 20px;
366
+
367
+  .border {
368
+    border-bottom: 1px #dcdfe6 solid;
369
+    margin: 0px 0 20px 0;
370
+  }
371
+
372
+  }
373
+
374
+  .title {
375
+    background: #409eff;
376
+    height: 44px;
377
+    line-height: 44px;
378
+    padding: 0 0 0 10px;
379
+    color: #fff;
380
+    margin: 0 0 10px 0;
381
+
382
+  }
383
+
384
+  .edit_separater {
385
+    border-top: 1px solid rgb(233, 233, 233);
386
+    margin-top: 15px;
387
+    margin-bottom: 15px;
388
+  }
389
+
390
+</style>
391
+
392
+<style>
393
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
394
+    font-size: 12px;
395
+  }
396
+
397
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
398
+    background: #6fb5fa;
399
+  }
400
+
401
+  .count {
402
+    color: #bd2c00;
403
+
404
+  }
405
+
406
+</style>

+ 442 - 0
src/xt_pages/stock/stockOutOrderAdd.vue Целия файл

@@ -0,0 +1,442 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <sales-return-dialog :propForm="propForm"
6
+                         :visibility="isVisibility"
7
+                         v-on:dialog-comfirm="comfirm"
8
+                         v-on:dialog-cancle="cancle"></sales-return-dialog>
9
+
10
+    <div class="filter-container">
11
+
12
+      <el-row>
13
+        <el-col :span="8"><div>
14
+          <span>退货时间:</span>
15
+          <el-date-picker v-model="warehouse_out_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
16
+                          type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
17
+                          value-format="yyyy-MM-dd"></el-date-picker>
18
+        </div></el-col>
19
+
20
+
21
+        <el-col :span="8">
22
+          <div>
23
+            <el-form ref="form" :model="form" :rules="ruleForm" label-width="80px">
24
+              <el-form-item label="厂商:" prop="manufacturer">
25
+                <el-select v-model="form.manufacturer" placeholder="请选择厂商">
26
+                  <el-option v-for="(option, index) in manufacturer" :key="index" :label="option.manufacturer_name" :value="option.id"></el-option>
27
+                </el-select>
28
+              </el-form-item>
29
+            </el-form>
30
+          </div>
31
+        </el-col>
32
+        <el-col :span="8">
33
+          <div>
34
+            <el-form ref="form" :model="form" label-width="80px">
35
+              <el-form-item label="经销商:">
36
+                <el-select v-model="form.dealer" placeholder="请选择经销商">
37
+                  <el-option v-for="(option, index) in dealer" :key="index" :label="option.dealer_name" :value="option.id"></el-option>
38
+                </el-select>
39
+              </el-form-item>
40
+            </el-form>
41
+          </div>
42
+        </el-col>
43
+      </el-row>
44
+
45
+    </div>
46
+
47
+    <el-row>
48
+      <el-col>
49
+        <el-form  :rules="tableRules" :model="recordInfo" ref="tableForm">
50
+          <el-table :data="recordInfo.recordData" :class="signAndWeighBoxPatients" style="width: 100%" border
51
+                    max-height="450"
52
+          >
53
+
54
+            <el-table-column label="操作" align="center" min-width="30">
55
+              <template slot-scope="scope">
56
+                <el-button
57
+                  size="mini"
58
+                  @click="handleEdit(scope.$index, scope.row)">+
59
+                </el-button>
60
+                <el-button
61
+                  size="mini"
62
+                  type="danger"
63
+                  @click="handleDelete(scope.$index, scope.row)">-
64
+                </el-button>
65
+              </template>
66
+            </el-table-column>
67
+
68
+            <el-table-column min-width="35" align="center">
69
+
70
+              <template slot="header" slot-scope="scope">
71
+                <span>物品类型<span style="color: red">*</span></span>
72
+              </template>
73
+
74
+              <template slot-scope="scope" >
75
+                <!--<span @click="showDialog(scope.$index, scope.row)" v-if="scope.row.good_type_id == 0" style="color:#c5c8cf">请输入类型</span>-->
76
+                <!--<span @click="showDialog(scope.$index, scope.row)" v-if="scope.row.good_type_id != 0">{{typeName(scope.row.good_type_id)}}</span>-->
77
+
78
+                <el-form-item  style="padding-top: 15px">
79
+                  <el-input placeholder="请输入物品类型"  v-model="scope.row.good_type_id" :value="typeName(scope.row.good_type_id)" @focus="showDialog(scope.$index, scope.row)" ></el-input>
80
+                </el-form-item>
81
+
82
+              </template>
83
+            </el-table-column>
84
+            <el-table-column min-width="35" align="center">
85
+              <template slot="header" slot-scope="scope">
86
+                <span>规格名称<span style="color: red">*</span></span>
87
+              </template>
88
+              <template slot-scope="scope">
89
+
90
+                <el-form-item  style="padding-top: 15px">
91
+                  <el-input placeholder="请输入规格名称"  v-model="scope.row.good_id" :value="specificationName(scope.row.good_id)" @focus="showDialog(scope.$index, scope.row)" ></el-input>
92
+                </el-form-item>
93
+
94
+              </template>
95
+            </el-table-column>
96
+
97
+
98
+            <el-table-column  min-width="23" align="center">
99
+              <template slot="header" slot-scope="scope">
100
+                <span>单价<span style="color: red">*</span></span>
101
+              </template>
102
+              <template slot-scope="scope">
103
+                <!--<el-input type="number" v-model="scope.row.price"  @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
104
+                <el-form-item :prop="'recordData.' + scope.$index + '.price'" :rules='tableRules.price' style="padding-top: 17px">
105
+                  <el-input type="number"  v-model="scope.row.price" ></el-input>
106
+                </el-form-item>
107
+
108
+
109
+              </template>
110
+            </el-table-column>
111
+
112
+            <el-table-column  min-width="23" align="center">
113
+              <template slot="header" slot-scope="scope">
114
+                <span>出库数量<span style="color: red">*</span></span>
115
+              </template>
116
+              <template slot-scope="scope">
117
+                <el-form-item :prop="'recordData.' + scope.$index + '.count'" :rules='tableRules.count' style="padding-top: 17px">
118
+                  <el-input type="number"  v-model="scope.row.count" ></el-input>
119
+                </el-form-item>
120
+              </template>
121
+            </el-table-column>
122
+
123
+            <el-table-column label="总价" min-width="20" align="center">
124
+              <template slot-scope="scope">
125
+                {{calculate(scope.row.price*scope.row.count)}}
126
+              </template>
127
+            </el-table-column>
128
+            <el-table-column label="备注" min-width="20" align="center">
129
+              <template slot-scope="scope">
130
+                <el-input  v-model="scope.row.remark"></el-input>
131
+              </template>
132
+            </el-table-column>
133
+          </el-table>
134
+        </el-form>
135
+      </el-col>
136
+
137
+
138
+      <span  class="dialog-footer" style="margin-top: 20px;float:right">
139
+        <el-button @click="back()">取 消</el-button>
140
+        <el-button type="primary" @click="submit()">确 定</el-button>
141
+      </span>
142
+
143
+    </el-row>
144
+  </div>
145
+</template>
146
+
147
+<script>
148
+  import { uParseTime } from '@/utils/tools'
149
+  import {
150
+    getSalesReturnConfig,
151
+    postWarehouseOut,
152
+  } from '@/api/stock'
153
+  import SalesReturnDialog from './Dialog/salesReturnDialog'
154
+
155
+  export default {
156
+    components: { SalesReturnDialog},
157
+    name: 'salesReturnOrderAdd',
158
+
159
+    data() {
160
+      return {
161
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
162
+        warehouse_out_time: '',
163
+        currentIndex: 0,
164
+        recordInfo: {
165
+          recordData: [],
166
+        },
167
+        tableRules: {
168
+          price: [
169
+            { required: true, message: '单价不能为空', trigger: 'blur' }
170
+          ],
171
+          count: [
172
+            { required: true, message: '数量不能为空', trigge: 'blur' }
173
+          ],
174
+        },
175
+        ruleForm: {
176
+          manufacturer: [
177
+            { required: true, message: '请选择厂商', trigger: 'change' }
178
+          ]
179
+
180
+        },
181
+        // prop
182
+        isVisibility: false,
183
+        propForm: {
184
+          goodType: [],
185
+          goodInfo: [],
186
+          goodUnit: [],
187
+        },
188
+        form: {
189
+          manufacturer: '',
190
+          dealer: ''
191
+        },
192
+
193
+        manufacturer: [],
194
+        dealer: [],
195
+        goodType: []
196
+      }
197
+    },
198
+    methods: {
199
+      comfirm: function(val) {
200
+        this.isVisibility = false
201
+        if (val.selectedGoodInfo.length > 0) {
202
+          for (let i = val.selectedGoodInfo.length - 1; ;i--) {
203
+            if (i == 0) {
204
+              this.recordInfo.recordData[this.currentIndex].good_type_id = val.goodTypeId
205
+              this.recordInfo.recordData[this.currentIndex].good_id = val.selectedGoodInfo[i].id
206
+            } else {
207
+              const tempForm = {}
208
+              tempForm['good_type_id'] = val.goodTypeId
209
+              tempForm['good_id'] = val.selectedGoodInfo[i].id
210
+              tempForm['count'] = ''
211
+              tempForm['price'] = ''
212
+              tempForm['remark'] = ''
213
+
214
+              this.recordInfo.recordData.push(tempForm)
215
+            }
216
+          }
217
+        }
218
+
219
+        this.currentIndex = -1
220
+      }, cancle: function() {
221
+        this.isVisibility = false
222
+      }, GetConfigInfo: function() {
223
+        getSalesReturnConfig().then(response => {
224
+          if (response.data.state == 0) {
225
+            this.$message.error(response.data.msg)
226
+            return false
227
+          } else {
228
+            var warehouseList =  response.data.data.warehouseList
229
+            var warehouseInfoList =  response.data.data.warehouseInfoList
230
+            for (let i = 0; i <warehouseList.length; i++ ){
231
+              if(warehouseList[i].Manufacturer.id > 0){
232
+                this.manufacturer.push(warehouseList[i].Manufacturer)
233
+              }
234
+              if(warehouseList[i].Dealer.id > 0){
235
+                this.dealer.push(warehouseList[i].Dealer)
236
+              }
237
+            }
238
+            for (let i = 0; i < warehouseInfoList.length; i++) {
239
+              this.propForm.goodInfo.push(warehouseInfoList[i].GoodInfo)
240
+
241
+            }
242
+            const obj = {}
243
+            const obj2 = {}
244
+            const obj4 = {}
245
+            //去重复
246
+            this.manufacturer =  this.manufacturer.reduce((cur, next) => {
247
+              obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
248
+              return cur
249
+            }, [])
250
+            //去重复
251
+            this.dealer =  this.dealer.reduce((cur, next) => {
252
+              obj2[next.id] ? '' : obj2[next.id] = true && cur.push(next)
253
+              return cur
254
+            }, [])
255
+            this.propForm.goodInfo = this.propForm.goodInfo.reduce((cur, next) => {
256
+              obj4[next.id] ? '' : obj4[next.id] = true && cur.push(next)
257
+              return cur
258
+            }, [])
259
+
260
+
261
+          }
262
+        })
263
+      }, typeName: function(good_type_id) {
264
+        let name = ''
265
+        for (let i = 0; i < this.propForm.goodType.length; i++) {
266
+          if (this.propForm.goodType[i].id == good_type_id) {
267
+            name = this.propForm.goodType[i].type_name
268
+          }
269
+        }
270
+        return name
271
+      }, specificationName: function(good_info_id) {
272
+        let name = ''
273
+        for (let i = 0; i < this.propForm.goodInfo.length; i++) {
274
+          if (this.propForm.goodInfo[i].id == good_info_id) {
275
+            name = this.propForm.goodInfo[i].specification_name
276
+          }
277
+        }
278
+        return name
279
+      }, handleEdit: function(index, row) {
280
+        const tempObj = {}
281
+        tempObj['good_type_id'] = 0
282
+        tempObj['good_id'] = 0
283
+        tempObj['count'] = ''
284
+        tempObj['price'] = ''
285
+        tempObj['remark'] = ''
286
+
287
+
288
+        this.recordInfo.recordData.push(tempObj)
289
+      }, handleDelete: function(index, row) {
290
+        this.recordInfo.recordData.splice(index, 1)
291
+      }, calculate: function(val) {
292
+        if(isNaN(val)){
293
+          return ''
294
+        }
295
+        if (val == 0) {
296
+          return ''
297
+        }
298
+        return Math.round(parseFloat(val) * 100) / 100
299
+      }, getTime(val, temp) {
300
+        if (val != 0) {
301
+          return uParseTime(val, temp)
302
+        } else {
303
+          return ''
304
+        }
305
+      }, showDialog(index, row) {
306
+        this.currentIndex = index
307
+        if (this.form.manufacturer == '' || this.form.manufacturer == 0) {
308
+          this.$message.error('请先选择厂商')
309
+          return
310
+        } else {
311
+          this.isVisibility = true
312
+          console.log(this.form.manufacturer)
313
+          for (let i = 0; i < this.propForm.goodInfo.length; i++){
314
+            if(this.propForm.goodInfo[i].manufacturer == this.form.manufacturer){
315
+              this.propForm.goodType.push(this.propForm.goodInfo[i].GoodsType)
316
+            }
317
+
318
+          }
319
+          const obj3 = {}
320
+          this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
321
+            obj3[next.id] ? '' : obj3[next.id] = true && cur.push(next)
322
+            return cur
323
+          }, [])
324
+
325
+
326
+
327
+        }
328
+      }, back() {
329
+        this.$router.go(-1)
330
+      }, submit() {
331
+        this.$refs['tableForm'].validate((valid) => {
332
+          if (valid) {
333
+            if (this.form.manufacturer == 0) {
334
+              this.$message.error('厂商不能为空')
335
+              return
336
+            }
337
+            const array = this.recordInfo.recordData
338
+            let total = 0
339
+            for (let i = 0; i < array.length; i++) {
340
+              if (array[i].good_type_id == 0) {
341
+                this.$message.error('物品类型不能为空')
342
+                return
343
+              }
344
+              if (array[i].good_id == 0) {
345
+                this.$message.error('规格名称不能为空')
346
+                return
347
+              }
348
+              total = total + array[i].price * array[i].return_count
349
+            }
350
+            const params = {
351
+              'stockOut': this.recordInfo.recordData
352
+            }
353
+            console.log(this.form.dealer)
354
+
355
+
356
+            postWarehouseOut(params,this.warehouse_out_time,this.form.dealer,this.form.manufacturer).then(response=>{
357
+              if (response.data.state==0) {
358
+                this.$message.error(response.data.msg);
359
+                return false;
360
+              }else {
361
+                this.$notify({
362
+                  title: "成功",
363
+                  message: "退货成功",
364
+                  type: "success",
365
+                  duration: 2000
366
+                });
367
+                this.recordInfo.recordData = []
368
+                this.$router.back(-1)
369
+              }
370
+            });
371
+          } else {
372
+            return false
373
+          }
374
+        })
375
+      }
376
+    },
377
+    created() {
378
+      var year = new Date().getFullYear()
379
+      var month = new Date().getMonth() + 1
380
+      var day = new Date().getDate()
381
+      if (parseInt(month) < 10) {
382
+        month = '0' + month
383
+      }
384
+      if (parseInt(day) < 10) {
385
+        day = '0' + day
386
+      }
387
+      const endTime = year + '-' + month + '-' + day
388
+      this.warehouse_out_time = endTime
389
+      const tempObj = {}
390
+      tempObj['good_type_id'] = 0
391
+      tempObj['good_id'] = 0
392
+      tempObj['return_count'] = 0
393
+      tempObj['price'] = ''
394
+      tempObj['remark'] = ''
395
+
396
+      this.recordInfo.recordData.push(tempObj)
397
+      this.GetConfigInfo()
398
+      this.propForm.goodUnit = this.$store.getters.good_unit
399
+    }
400
+
401
+  }
402
+</script>
403
+
404
+<style rel="stylesheet/css" lang="scss" scoped>
405
+  .information {
406
+    border: 1px #dcdfe6 solid;
407
+    padding: 30px 20px 30px 20px;
408
+
409
+  .border {
410
+    border-bottom: 1px #dcdfe6 solid;
411
+    margin: 0px 0 20px 0;
412
+  }
413
+  }
414
+
415
+  .title {
416
+    background: #409eff;
417
+    height: 44px;
418
+    line-height: 44px;
419
+    padding: 0 0 0 10px;
420
+    color: #fff;
421
+    margin: 0 0 10px 0;
422
+  // border-radius: 4px 4px 0 0;
423
+  }
424
+
425
+  .edit_separater {
426
+    border-top: 1px solid rgb(233, 233, 233);
427
+    margin-top: 15px;
428
+    margin-bottom: 15px;
429
+  }
430
+
431
+</style>
432
+
433
+<style>
434
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
435
+    font-size: 12px;
436
+  }
437
+
438
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
439
+    background: #6fb5fa;
440
+  }
441
+
442
+</style>

+ 258 - 0
src/xt_pages/stock/stockOutOrderDetail.vue Целия файл

@@ -0,0 +1,258 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <div class="filter-container">
6
+      <span style="font-size: 20px">退货单详情</span>
7
+      <el-row style="float:right;">
8
+        <span>{{warehousingOutInfo.info.warehouse_out_order_number}}</span>
9
+      </el-row>
10
+    </div>
11
+
12
+
13
+
14
+    <div class="filter-container">
15
+      <span>单据日期:  {{warehousingOutInfo.info.warehouse_out_time | parseTime('{y}-{m}-{d}')}} </span>
16
+      <span>厂商 {{getManufactuerName(warehousingOutInfo.info.manufacturer)}}</span>
17
+      <span>经销商 {{getDealerName(warehousingOutInfo.info.dealer)}}</span>
18
+    </div>
19
+
20
+    <div class="filter-container" style="margin-top: 10px">
21
+      <el-button size="small" icon="el-icon-edit" @click="editRecord">编辑</el-button>
22
+      <el-button size="small" icon="el-icon-delete" @click="deleteRecord">删除</el-button>
23
+    </div>
24
+
25
+    <el-row :gutter="12" style="margin-top: 10px">
26
+      <el-table :data="warehousingOutInfo.warehousingOutData" :class="signAndWeighBoxPatients" style="width: 100%" border
27
+      >
28
+        <el-table-column min-width="35" align="center">
29
+          <template slot="header" slot-scope="scope">
30
+            <span>物品类型</span>
31
+          </template>
32
+
33
+          <template slot-scope="scope">
34
+            <span v-if="scope.row.good_type_id != 0">{{getTypeName(scope.row.good_type_id)}}</span>
35
+          </template>
36
+        </el-table-column>
37
+        <el-table-column min-width="35" align="center">
38
+          <template slot="header" slot-scope="scope">
39
+            <span>规格名称</span>
40
+          </template>
41
+          <template slot-scope="scope">
42
+            <span v-if="scope.row.good_id != 0">{{getSpecificationName(scope.row.good_id)}}</span>
43
+          </template>
44
+        </el-table-column>
45
+
46
+
47
+        <el-table-column min-width="23" align="center">
48
+          <template slot="header" slot-scope="scope">
49
+            <span>单价</span>
50
+          </template>
51
+          <template slot-scope="scope">
52
+            <span>{{scope.row.price}}</span>
53
+          </template>
54
+        </el-table-column>
55
+
56
+        <el-table-column min-width="23" align="center">
57
+          <template slot="header" slot-scope="scope">
58
+            <span>出库数量</span>
59
+          </template>
60
+          <template slot-scope="scope">
61
+            <span>{{scope.row.count}}</span>
62
+
63
+          </template>
64
+        </el-table-column>
65
+        <el-table-column label="总价" min-width="20" align="center">
66
+          <template slot-scope="scope">
67
+            {{calculate(scope.row.price*scope.row.count)}}
68
+          </template>
69
+        </el-table-column>
70
+
71
+        <el-table-column label="备注" min-width="20"  align="center">
72
+          <template slot-scope="scope">
73
+            <el-popover placement="top-start"  width="250" trigger="hover" >
74
+              <div>{{scope.row.remark}}</div>
75
+              <span slot="reference" v-if="scope.row.remark.length > 20">{{ scope.row.remark.substr(0,20)+'...' }}</span>
76
+              <span slot="reference" v-else>{{ scope.row.remark}}</span>
77
+            </el-popover>
78
+
79
+          </template>
80
+        </el-table-column>
81
+
82
+
83
+      </el-table>
84
+    </el-row>
85
+  </div>
86
+</template>
87
+
88
+<script>
89
+  import { uParseTime } from '@/utils/tools'
90
+  import { GetAllConfig,getWarehouseOutInfo,deleteWarehouseOut } from '@/api/stock'
91
+
92
+  export default {
93
+    name: 'stockInOrderDetail',
94
+    created() {
95
+      const order_id = this.$route.query.id
96
+      this.GetConfigInfo()
97
+      this.GetOrderDetail(order_id)
98
+    },
99
+    data() {
100
+      return {
101
+        isEdit: 0,
102
+        checked: false,
103
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
104
+        goodType: [],
105
+        goodInfo: [],
106
+        manufacturer: [],
107
+        dealer: [],
108
+
109
+        warehousingOutInfo: {
110
+          loading: false,
111
+          warehousingOutData: [],
112
+          info: {}
113
+        }
114
+      }
115
+    },
116
+    methods: {
117
+      getSpecificationName: function(id) {
118
+        let name = ''
119
+        for (let i = 0; i < this.goodInfo.length; i++) {
120
+          if (this.goodInfo[i].id == id) {
121
+            name = this.goodInfo[i].specification_name
122
+          }
123
+        }
124
+        return name
125
+      }, getTypeName: function(id) {
126
+        let name = ''
127
+        for (let i = 0; i < this.goodType.length; i++) {
128
+          if (this.goodType[i].id == id) {
129
+            name = this.goodType[i].type_name
130
+          }
131
+        }
132
+        return name
133
+      }, GetConfigInfo: function() {
134
+        GetAllConfig().then(response => {
135
+          if (response.data.state == 0) {
136
+            this.$message.error(response.data.msg)
137
+            return false
138
+          } else {
139
+            this.manufacturer = response.data.data.manufacturer
140
+            this.dealer = response.data.data.dealer
141
+            this.goodInfo = response.data.data.goodInfo
142
+            this.goodType = response.data.data.goodType
143
+          }
144
+        })
145
+      }, getManufactuerName: function(manufacturer_id) {
146
+        for (let i = 0; i < this.manufacturer.length; i++) {
147
+          if (this.manufacturer[i].id == manufacturer_id) {
148
+            return this.manufacturer[i].manufacturer_name
149
+          }
150
+        }
151
+      }, getDealerName: function(dealer_id) {
152
+        for (let i = 0; i < this.dealer.length; i++) {
153
+          if (this.dealer[i].id == dealer_id) {
154
+            return this.dealer[i].dealer_name
155
+          }
156
+        }
157
+      }, calculate: function(val) {
158
+        if (val == 0) {
159
+          return ''
160
+        }
161
+        return Math.round(parseFloat(val) * 100) / 100
162
+      }, GetOrderDetail: function(order_id) {
163
+        const params = {
164
+          'id': order_id
165
+        }
166
+        getWarehouseOutInfo(params).then(response => {
167
+          if (response.data.state == 0) {
168
+            this.$message.error(response.data.msg)
169
+            return false
170
+          } else {
171
+            for (let i = 0; i < response.data.data.list.length; i++) {
172
+              this.warehousingOutInfo.warehousingOutData.push(response.data.data.list[i])
173
+            }
174
+            this.warehousingOutInfo.info = response.data.data.info
175
+          }
176
+        })
177
+      }, deleteRecord: function() {
178
+        const ids = []
179
+        ids.push(this.warehousingOutInfo.info.id)
180
+        const idStr = ids.join(',')
181
+
182
+        const params = {
183
+          ids: idStr
184
+        }
185
+
186
+        this.$confirm('确认删除退货单?', '删除退货单记录', {
187
+          confirmButtonText: '确定',
188
+          cancelButtonText: '取消',
189
+          type: 'warning'
190
+        }).then(() => {
191
+          deleteWarehouseOut(params).then(response => {
192
+            if (response.data.state == 0) {
193
+              this.$message.error(response.data.msg)
194
+              return false
195
+            } else {
196
+              this.$notify({
197
+                title: '成功',
198
+                message: '删除成功',
199
+                type: 'success',
200
+                duration: 2000
201
+              })
202
+
203
+              this.$router.back(-1)
204
+            }
205
+          })
206
+        }).catch(() => {
207
+        })
208
+      }, editRecord: function() {
209
+        this.$emit('edit-record')
210
+      }
211
+    }
212
+  }
213
+</script>
214
+
215
+<style rel="stylesheet/css" lang="scss" scoped>
216
+  .information {
217
+    border: 1px #dcdfe6 solid;
218
+    padding: 30px 20px 30px 20px;
219
+
220
+  .border {
221
+    border-bottom: 1px #dcdfe6 solid;
222
+    margin: 0px 0 20px 0;
223
+  }
224
+
225
+  }
226
+
227
+  .title {
228
+    background: #409eff;
229
+    height: 44px;
230
+    line-height: 44px;
231
+    padding: 0 0 0 10px;
232
+    color: #fff;
233
+    margin: 0 0 10px 0;
234
+  }
235
+
236
+  .edit_separater {
237
+    border-top: 1px solid rgb(233, 233, 233);
238
+    margin-top: 15px;
239
+    margin-bottom: 15px;
240
+  }
241
+
242
+</style>
243
+
244
+<style>
245
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
246
+    font-size: 12px;
247
+  }
248
+
249
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
250
+    background: #6fb5fa;
251
+  }
252
+
253
+  .count {
254
+    color: #bd2c00;
255
+
256
+  }
257
+
258
+</style>

+ 425 - 0
src/xt_pages/stock/stockOutOrderEdit.vue Целия файл

@@ -0,0 +1,425 @@
1
+<template>
2
+
3
+  <div class="app-container sign-and-weigh-box">
4
+
5
+    <sales-return-dialog :propForm="propForm"
6
+                     :visibility="isVisibility"
7
+                     v-on:dialog-comfirm="comfirm"
8
+                     v-on:dialog-cancle="cancle"></sales-return-dialog>
9
+
10
+    <div class="filter-container">
11
+
12
+      <el-row>
13
+        <el-col :span="8">
14
+          <div>
15
+            <span>入库时间:</span>
16
+            <el-date-picker v-model="warehouse_out_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
17
+                            type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
18
+                            value-format="yyyy-MM-dd"></el-date-picker>
19
+          </div>
20
+        </el-col>
21
+      </el-row>
22
+    </div>
23
+
24
+    <el-row>
25
+      <el-col>
26
+        <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
27
+          <el-table :data="recordInfo.recordData" :class="signAndWeighBoxPatients" style="width: 100%" border
28
+                    max-height="450"
29
+          >
30
+
31
+            <el-table-column label="操作" align="center" min-width="30">
32
+              <template slot-scope="scope">
33
+                <el-button
34
+                  size="mini"
35
+                  @click="handleEdit(scope.$index, scope.row)">+
36
+                </el-button>
37
+                <el-button
38
+                  size="mini"
39
+                  type="danger"
40
+                  @click="handleDelete(scope.$index, scope.row)">-
41
+                </el-button>
42
+              </template>
43
+            </el-table-column>
44
+
45
+            <el-table-column min-width="35" align="center">
46
+
47
+              <template slot="header" slot-scope="scope">
48
+                <span>物品类型<span style="color: red">*</span></span>
49
+              </template>
50
+
51
+              <template slot-scope="scope">
52
+                <el-form-item style="padding-top: 15px">
53
+                  <el-input placeholder="请输入物品类型" v-model="scope.row.good_type_id"
54
+                            :value="typeName(scope.row.good_type_id)"
55
+                            @focus="showDialog(scope.$index, scope.row)"></el-input>
56
+                </el-form-item>
57
+              </template>
58
+            </el-table-column>
59
+            <el-table-column min-width="35" align="center">
60
+              <template slot="header" slot-scope="scope">
61
+                <span>规格名称<span style="color: red">*</span></span>
62
+              </template>
63
+              <template slot-scope="scope">
64
+
65
+                <el-form-item style="padding-top: 15px">
66
+                  <el-input placeholder="请输入规格名称" v-model="scope.row.good_id"
67
+                            :value="specificationName(scope.row.good_id)"
68
+                            @focus="showDialog(scope.$index, scope.row)"></el-input>
69
+                </el-form-item>
70
+
71
+              </template>
72
+            </el-table-column>
73
+
74
+
75
+            <el-table-column  min-width="23" align="center">
76
+              <template slot="header" slot-scope="scope">
77
+                <span>单价<span style="color: red">*</span></span>
78
+              </template>
79
+              <template slot-scope="scope">
80
+                <!--<el-input type="number" v-model="scope.row.price"  @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
81
+                <el-form-item :prop="'recordData.' + scope.$index + '.price'" :rules='tableRules.price' style="padding-top: 17px">
82
+                  <el-input type="number"  v-model="scope.row.price" ></el-input>
83
+                </el-form-item>
84
+
85
+
86
+              </template>
87
+            </el-table-column>
88
+
89
+            <el-table-column  min-width="23" align="center">
90
+              <template slot="header" slot-scope="scope">
91
+                <span>出库数量<span style="color: red">*</span></span>
92
+              </template>
93
+              <template slot-scope="scope">
94
+                <el-form-item :prop="'recordData.' + scope.$index + '.count'" :rules='tableRules.count' style="padding-top: 17px">
95
+                  <el-input type="number"  v-model="scope.row.count" ></el-input>
96
+                </el-form-item>
97
+              </template>
98
+            </el-table-column>
99
+
100
+            <el-table-column label="总价" min-width="20" align="center">
101
+              <template slot-scope="scope">
102
+                {{calculate(scope.row.price*scope.row.count)}}
103
+              </template>
104
+            </el-table-column>
105
+            <el-table-column label="备注" min-width="20" align="center">
106
+              <template slot-scope="scope">
107
+                <el-input  v-model="scope.row.remark"></el-input>
108
+              </template>
109
+            </el-table-column>
110
+          </el-table>
111
+        </el-form>
112
+      </el-col>
113
+
114
+
115
+      <span class="dialog-footer" style="margin-top: 20px;float:right">
116
+        <el-button @click="back()">取 消</el-button>
117
+        <el-button type="primary" @click="submit()">确 定</el-button>
118
+      </span>
119
+
120
+    </el-row>
121
+  </div>
122
+</template>
123
+
124
+<script>
125
+  import { uParseTime } from '@/utils/tools'
126
+
127
+  import {
128
+    deleteWarehouseOutInfo,
129
+    getWarehouseOutInfo,
130
+    getSalesReturnConfig,
131
+    editWarehouseoutInfo
132
+  } from '@/api/stock'
133
+  import SalesReturnDialog from './Dialog/salesReturnDialog'
134
+
135
+  export default {
136
+    components: { SalesReturnDialog},
137
+    name: 'salesReturnEdit',
138
+
139
+    data() {
140
+      return {
141
+        signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
142
+
143
+        adminUserOptions: null,
144
+        currentIndex: 0,
145
+        warehouse_out_time: '',
146
+        recordInfo: {
147
+          recordData: [],
148
+          stock_in_code: '',
149
+          current_index: ''
150
+
151
+        },
152
+        tableRules: {
153
+          count: [
154
+            { required: true, message: '数量不能为空', trigge: 'blur' }
155
+          ],
156
+          price: [
157
+            { required: true, message: '单价不能为空', trigger: 'blur' }
158
+          ],
159
+
160
+        },
161
+        ruleForm: {
162
+          manufacturer: [
163
+            { required: true, message: '请选择厂商', trigger: 'change' }
164
+          ]
165
+        },
166
+        // prop
167
+        isVisibility: false,
168
+        propForm: {
169
+          goodType: [],
170
+          goodInfo: [],
171
+          goodUnit: [],
172
+          title: '入库'
173
+        },
174
+
175
+        form: {
176
+          manufacturer: '',
177
+          dealer: ''
178
+        },
179
+
180
+        warehouseOut: {},
181
+        manufacturer: [],
182
+        dealer: [],
183
+        goodType: []
184
+      }
185
+    },
186
+    methods: {
187
+      comfirm: function(val) {
188
+        this.isVisibility = false
189
+        if (val.selectedGoodInfo.length > 0) {
190
+          for (let i = val.selectedGoodInfo.length - 1; ; i--) {
191
+            if (i == 0) {
192
+              this.recordInfo.recordData[this.currentIndex].good_type_id = val.goodTypeId
193
+              this.recordInfo.recordData[this.currentIndex].good_id = val.selectedGoodInfo[i].id
194
+            } else {
195
+              const tempForm = {}
196
+              tempForm['id'] = 0
197
+              tempForm['good_type_id'] = val.goodTypeId
198
+              tempForm['good_id'] = val.selectedGoodInfo[i].id
199
+              tempForm['count'] = ''
200
+              tempForm['price'] = ''
201
+              tempForm['remark'] = ''
202
+
203
+              this.recordInfo.recordData.push(tempForm)
204
+            }
205
+          }
206
+        }
207
+
208
+        this.currentIndex = -1
209
+      }, cancle: function() {
210
+        this.isVisibility = false
211
+      }, GetConfigInfo: function() {
212
+        getSalesReturnConfig().then(response => {
213
+          if (response.data.state == 0) {
214
+            this.$message.error(response.data.msg)
215
+            return false
216
+          } else {
217
+            var warehouseInfoList = response.data.data.warehouseInfoList
218
+            for (let i = 0; i < warehouseInfoList.length; i++) {
219
+              this.propForm.goodInfo.push(warehouseInfoList[i].GoodInfo)
220
+              this.propForm.goodType.push(warehouseInfoList[i].GoodInfo.GoodsType)
221
+
222
+            }
223
+            const obj3 = {}
224
+            const obj4 = {}
225
+            this.propForm.goodInfo = this.propForm.goodInfo.reduce((cur, next) => {
226
+              obj4[next.id] ? '' : obj4[next.id] = true && cur.push(next)
227
+              return cur
228
+            }, [])
229
+            this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
230
+              obj3[next.id] ? '' : obj3[next.id] = true && cur.push(next)
231
+              return cur
232
+            }, [])
233
+          }
234
+        })
235
+      }, typeName: function(good_type_id) {
236
+        let name = ''
237
+        for (let i = 0; i < this.propForm.goodType.length; i++) {
238
+          if (this.propForm.goodType[i].id == good_type_id) {
239
+            name = this.propForm.goodType[i].type_name
240
+          }
241
+        }
242
+        return name
243
+      }, specificationName: function(good_info_id) {
244
+        let name = ''
245
+        for (let i = 0; i < this.propForm.goodInfo.length; i++) {
246
+          if (this.propForm.goodInfo[i].id == good_info_id) {
247
+            name = this.propForm.goodInfo[i].specification_name
248
+          }
249
+        }
250
+        return name
251
+      }, handleEdit: function(index, row) {
252
+        const tempObj = {}
253
+        tempObj['id'] = 0
254
+        tempObj['good_type_id'] = 0
255
+        tempObj['good_id'] = 0
256
+        tempObj['count'] = ''
257
+        tempObj['price'] = ''
258
+        tempObj['remark'] = ''
259
+        this.recordInfo.recordData.push(tempObj)
260
+      }, handleDelete: function(index, row) {
261
+        if (row.id == 0) {
262
+          this.recordInfo.recordData.splice(index, 1)
263
+        } else {
264
+          const params = {
265
+            id: row.id
266
+          }
267
+          this.$confirm('确认删除该退货物品信息记录?', '删除退货物品信息记录', {
268
+            confirmButtonText: '确定',
269
+            cancelButtonText: '取消',
270
+            type: 'warning'
271
+          }).then(() => {
272
+            deleteWarehouseOutInfo(params).then(response => {
273
+              if (response.data.state == 0) {
274
+                this.$message.error(response.data.msg)
275
+                return false
276
+              } else {
277
+                this.$notify({
278
+                  title: '成功',
279
+                  message: '删除成功',
280
+                  type: 'success',
281
+                  duration: 2000
282
+                })
283
+                this.recordInfo.recordData.splice(index, 1)
284
+              }
285
+            })
286
+          }).catch(() => {
287
+          })
288
+        }
289
+      }, getTime(val, temp) {
290
+        if (val != 0) {
291
+          return uParseTime(val, temp)
292
+        } else {
293
+          return ''
294
+        }
295
+      }, showDialog(index, row) {
296
+        this.currentIndex = index
297
+
298
+        this.isVisibility = true
299
+        console.log(this.form.manufacturer)
300
+        for (let i = 0; i < this.propForm.goodInfo.length; i++) {
301
+          if (this.propForm.goodInfo[i].manufacturer == this.form.manufacturer) {
302
+            this.propForm.goodType.push(this.propForm.goodInfo[i].GoodsType)
303
+          }
304
+        }
305
+        const obj3 = {}
306
+        this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
307
+          obj3[next.id] ? '' : obj3[next.id] = true && cur.push(next)
308
+          return cur
309
+        }, [])
310
+
311
+      }, back() {
312
+        this.$router.go(-1)
313
+      }, submit() {
314
+        this.$refs['tableForm'].validate((valid) => {
315
+          if (valid) {
316
+            const array = this.recordInfo.recordData
317
+            for (let i = 0; i < array.length; i++) {
318
+              if (array[i].good_type_id == 0) {
319
+                this.$message.error('物品类型不能为空')
320
+                return
321
+              }
322
+              if (array[i].good_id == 0) {
323
+                this.$message.error('规格名称不能为空')
324
+                return
325
+              }
326
+            }
327
+
328
+            const params = {
329
+              'stockOut': this.recordInfo.recordData
330
+            }
331
+            editWarehouseoutInfo(params, this.warehouse_out_time, this.$route.query.id).then(response => {
332
+              if (response.data.state == 0) {
333
+                this.$message.error(response.data.msg)
334
+                return false
335
+              } else {
336
+                this.$notify({
337
+                  title: '成功',
338
+                  message: '退货成功',
339
+                  type: 'success',
340
+                  duration: 2000
341
+                })
342
+                this.$router.back(-1)
343
+              }
344
+            })
345
+          } else {
346
+            return false
347
+          }
348
+        })
349
+      }, GetOrderDetail: function(order_id) {
350
+        const params = {
351
+          'id': order_id
352
+        }
353
+        getWarehouseOutInfo(params).then(response => {
354
+          if (response.data.state == 0) {
355
+            this.$message.error(response.data.msg)
356
+            return false
357
+          } else {
358
+            for (let i = 0; i < response.data.data.list.length; i++) {
359
+              response.data.data.list[i].price = response.data.data.list[i].price.toString()
360
+              response.data.data.list[i].count = response.data.data.list[i].count.toString()
361
+              this.recordInfo.recordData.push(response.data.data.list[i])
362
+            }
363
+            this.warehouseOut = response.data.data.info
364
+            this.warehouse_out_time = this.getTime(this.warehouseOut.warehouse_out_time, '{y}-{m}-{d}')
365
+
366
+          }
367
+
368
+        })
369
+      }, calculate: function(val) {
370
+        if (val == 0) {
371
+          return ''
372
+        }
373
+        return Math.round(parseFloat(val) * 100) / 100
374
+      }
375
+    },
376
+    created() {
377
+      this.GetConfigInfo()
378
+      this.propForm.goodUnit = this.$store.getters.good_unit
379
+      const order_id = this.$route.query.id
380
+      this.GetOrderDetail(order_id)
381
+    }
382
+
383
+  }
384
+</script>
385
+
386
+<style rel="stylesheet/css" lang="scss" scoped>
387
+  .information {
388
+    border: 1px #dcdfe6 solid;
389
+    padding: 30px 20px 30px 20px;
390
+
391
+  .border {
392
+    border-bottom: 1px #dcdfe6 solid;
393
+    margin: 0px 0 20px 0;
394
+  }
395
+
396
+  }
397
+
398
+  .title {
399
+    background: #409eff;
400
+    height: 44px;
401
+    line-height: 44px;
402
+    padding: 0 0 0 10px;
403
+    color: #fff;
404
+    margin: 0 0 10px 0;
405
+    border-radius: 4px 4px 0 0;
406
+  }
407
+
408
+  .edit_separater {
409
+    border-top: 1px solid rgb(233, 233, 233);
410
+    margin-top: 15px;
411
+    margin-bottom: 15px;
412
+  }
413
+
414
+</style>
415
+
416
+<style>
417
+  .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
418
+    font-size: 12px;
419
+  }
420
+
421
+  .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
422
+    background: #6fb5fa;
423
+  }
424
+
425
+</style>