XMLWAN 4 years ago
parent
commit
1c4d2e22d6

src/xt_pages/components/DrugExcel/index.vue → src/xt_pages/components/GoodExcel/index.vue View File

1
 <template>
1
 <template>
2
   <div>
2
   <div>
3
-    <input id="excel-drug-input" ref="excel-drug-input" type="file" accept=".xlsx, .xls, .xltx" @change="handleClick">
3
+    <input id="excel-good-input" ref="excel-good-input" type="file" accept=".xlsx, .xls, .xltx" @change="handleClick">
4
     <el-button :loading="loading" style="margin-left:16px;" size="mini" type="primary" @click="handleUpload">导入模板
4
     <el-button :loading="loading" style="margin-left:16px;" size="mini" type="primary" @click="handleUpload">导入模板
5
     </el-button>
5
     </el-button>
6
   </div>
6
   </div>
54
         e.dataTransfer.dropEffect = 'copy'
54
         e.dataTransfer.dropEffect = 'copy'
55
       },
55
       },
56
       handleUpload() {
56
       handleUpload() {
57
-        document.getElementById('excel-drug-input').click()
57
+        document.getElementById('excel-good-input').click()
58
       },
58
       },
59
       handleClick(e) {
59
       handleClick(e) {
60
         const files = e.target.files
60
         const files = e.target.files
63
         this.upload(rawFile)
63
         this.upload(rawFile)
64
       },
64
       },
65
       upload(rawFile) {
65
       upload(rawFile) {
66
-        this.$refs['excel-drug-input'].value = null // fix can't select the same excel
66
+        this.$refs['excel-good-input'].value = null // fix can't select the same excel
67
 
67
 
68
         if (!this.beforeUpload) {
68
         if (!this.beforeUpload) {
69
           this.readerData(rawFile)
69
           this.readerData(rawFile)
127
 </script>
127
 </script>
128
 
128
 
129
 <style scoped>
129
 <style scoped>
130
-  #excel-project-input {
130
+  #excel-good-input {
131
     display: none;
131
     display: none;
132
     z-index: -9999;
132
     z-index: -9999;
133
   }
133
   }

+ 18 - 72
src/xt_pages/data/components/consumables.vue View File

75
           >下载模版
75
           >下载模版
76
           </el-button>
76
           </el-button>
77
         </el-link>
77
         </el-link>
78
-        <upload-excel :on-success='handleSuccess'></upload-excel>
78
+        <good-excel :on-success='handleSuccess'></good-excel>
79
         <el-button
79
         <el-button
80
           style="margin-left:10px;"
80
           style="margin-left:10px;"
81
           @click="generateLog()"
81
           @click="generateLog()"
82
           class="filter-item"
82
           class="filter-item"
83
           type="primary"
83
           type="primary"
84
           size="small"
84
           size="small"
85
-        >下载日志 -->
86
-        </el-button>
85
+        >下载日志
86
+        </el-button> -->
87
       </div>
87
       </div>
88
 
88
 
89
     <el-table
89
     <el-table
244
     postGoodInformation
244
     postGoodInformation
245
   } from '@/api/stock'
245
   } from '@/api/stock'
246
   import UploadExcel from '@/xt_pages/components/UploadExcel'
246
   import UploadExcel from '@/xt_pages/components/UploadExcel'
247
+  import GoodExcel from '@/xt_pages/components/GoodExcel'
247
   import { generateLog } from '@/api/config'
248
   import { generateLog } from '@/api/config'
248
   export default {
249
   export default {
249
     components: {
250
     components: {
250
       GoodInfoDailog,
251
       GoodInfoDailog,
251
       selfPayment,
252
       selfPayment,
252
       UploadExcel,
253
       UploadExcel,
254
+      GoodExcel
253
     },
255
     },
254
     data() {
256
     data() {
255
       return {
257
       return {
531
               response.data.data.goodInfo.good_type_id
533
               response.data.data.goodInfo.good_type_id
532
 
534
 
533
 
535
 
534
-
535
-
536
             this.goodInfo.goodInfoDialog.formValue.good_name =
536
             this.goodInfo.goodInfoDialog.formValue.good_name =
537
               response.data.data.goodInfo.good_name
537
               response.data.data.goodInfo.good_name
538
 
538
 
552
                 response.data.data.goodInfo.good_kind
552
                 response.data.data.goodInfo.good_kind
553
             }
553
             }
554
 
554
 
555
-
556
-
557
             if (response.data.data.goodInfo.medical_insurance_level <= 0) {
555
             if (response.data.data.goodInfo.medical_insurance_level <= 0) {
558
               this.goodInfo.goodInfoDialog.formValue.medical_insurance_level = ''
556
               this.goodInfo.goodInfoDialog.formValue.medical_insurance_level = ''
559
             } else {
557
             } else {
1117
          this.getList()
1115
          this.getList()
1118
       },
1116
       },
1119
       handleSuccess({ results, header }) {
1117
       handleSuccess({ results, header }) {
1120
-        console.log("header",header)
1121
-        var goods = []
1118
+       
1122
         if (header != undefined && header.length > 0) {
1119
         if (header != undefined && header.length > 0) {
1123
             
1120
             
1124
           var isHasMedicalInsuranceLevel = header.includes('*医保等级')
1121
           var isHasMedicalInsuranceLevel = header.includes('*医保等级')
1125
-          // console.log("医保等级",isHasMedicalInsuranceLevel)
1122
+         
1126
           var isHasGoodUnit = header.includes('*单位')
1123
           var isHasGoodUnit = header.includes('*单位')
1127
-          // console.log("单位",isHasGoodUnit)
1124
+        
1128
           var isHasStockWarnCount = header.includes('*库存警戒')
1125
           var isHasStockWarnCount = header.includes('*库存警戒')
1129
-          // console.log("库存警戒",isHasStockWarnCount)
1126
+       
1130
           var isHasManuFacturer =  header.includes('*生产厂商')
1127
           var isHasManuFacturer =  header.includes('*生产厂商')
1131
-          // console.log("生产厂商",isHasManuFacturer)
1132
-          var isHasDealer =  header.includes('*经销商')
1133
-          // console.log("经销商",isHasDealer)
1128
+         
1134
           var isHasGoodName = header.includes('*耗材名称')
1129
           var isHasGoodName = header.includes('*耗材名称')
1135
-          // console.log("耗材名称",isHasGoodName)
1130
+        
1136
           var isHasGoodKand = header.includes('*耗材种类')
1131
           var isHasGoodKand = header.includes('*耗材种类')
1137
-          // console.log("耗材种类",isHasGoodKand)
1132
+          
1138
           var isHasSpecificationName = header.includes('*规格型号')
1133
           var isHasSpecificationName = header.includes('*规格型号')
1139
-          // console.log("规格型号",isHasSpecificationName)
1134
+        
1140
           var isHasBuyPrice = header.includes('*零价')
1135
           var isHasBuyPrice = header.includes('*零价')
1141
-          // console.log("零价",isHasBuyPrice)
1142
-         
1143
-          if (!(isHasMedicalInsuranceLevel && isHasGoodUnit && isHasStockWarnCount && isHasManuFacturer && isHasDealer && isHasGoodName && isHasGoodKand && isHasSpecificationName &&  isHasBuyPrice)) {
1136
+                
1137
+          if (!(isHasMedicalInsuranceLevel && isHasGoodUnit && isHasStockWarnCount && isHasManuFacturer  && isHasGoodName && isHasGoodKand && isHasSpecificationName &&  isHasBuyPrice)) {
1144
             this.dialogVisible = true
1138
             this.dialogVisible = true
1145
             return
1139
             return
1146
           }
1140
           }
1334
 
1328
 
1335
          }
1329
          }
1336
          tableData.push(obj)
1330
          tableData.push(obj)
1337
-         console.log("表哥2222",tableData)
1338
-         var goodKind  =  this.getDictionaryDataConfig('system','good_kind')
1339
-         
1340
-        //  console.log("耗材种类",goodKind)
1341
-        //  console.log("耗材类型",this.goodType)
1342
-        var medicalInsuranceLevel = this.getDictionaryDataConfig('system','medical_insurance_level')
1343
-        // console.log("医保等级",medicalInsuranceLevel)
1344
-        // console.log("生产厂商",this.manufacturers)
1345
-        // console.log("经销商",this.dealers)
1346
-        var statisticsCategory = getDictionaryDataConfig('system','statistics_category')
1347
-        // console.log("统计分类",statisticsCategory)
1348
-       
1349
         var goodUnit =  this.$store.getters.good_unit
1331
         var goodUnit =  this.$store.getters.good_unit
1350
        
1332
        
1351
 
1333
 
1352
         for(let i=0;i<tableData.length;i++){ 
1334
         for(let i=0;i<tableData.length;i++){ 
1353
-          for(let j=0;j<goodKind.length;j++){
1354
-             
1355
-             if(tableData[i].good_kind == goodKind[j].name){
1356
-                tableData[i].good_kind_id = goodKind[j].id
1357
-             }    
1358
-          }
1359
-
1360
-       for(let z=0;z<this.goodType.length;z++){
1361
-          if(tableData[i].type_name == this.goodType[z].type_name){
1362
-             tableData[i].good_type_id = this.goodType[z].id
1363
-           }
1364
-        }
1365
-        
1366
-        for(let y=0;y<medicalInsuranceLevel.length;y++){
1367
-           if(tableData[i].medical_insurance_level == medicalInsuranceLevel[y].name){
1368
-               tableData[i].medical_insurance_id = medicalInsuranceLevel[y].id
1369
-           }
1370
-        }
1371
-
1372
-        
1373
-        for(let a=0;a<this.manufacturers.length;a++){
1374
-           if(tableData[i].manufacturer == this.manufacturers[a].manufacturer_name){
1375
-               tableData[i].manufacturer_id = this.manufacturers[a].id
1376
-           }
1377
-        }
1378
-       
1379
-        for(let s=0;s<this.dealers.length;s++){
1380
-           if(tableData[i].dealer == this.dealers[s].dealer_name){
1381
-               tableData[i].dealer_id = this.dealers[s].id
1382
-           }
1383
-        }
1384
-        
1385
-        for(let h=0;h<statisticsCategory.length;h++){
1386
-           if(tableData[i].statistics_category == statisticsCategory[h].name){
1387
-               tableData[i].statistic_id = statisticsCategory[h].id
1388
-           }
1389
-         }
1390
-
1335
+      
1391
          for(let c=0;c<goodUnit.length;c++){
1336
          for(let c=0;c<goodUnit.length;c++){
1392
             if(tableData[i].good_unit == goodUnit[c].name){
1337
             if(tableData[i].good_unit == goodUnit[c].name){
1393
                tableData[i].unit_id = goodUnit[c].id
1338
                tableData[i].unit_id = goodUnit[c].id
1458
            if(response.data.state == 1){
1403
            if(response.data.state == 1){
1459
              var msg =  response.data.data.msg
1404
              var msg =  response.data.data.msg
1460
              this.$message.success("导入成功!")
1405
              this.$message.success("导入成功!")
1406
+             this.getList()
1461
            }else{
1407
            }else{
1462
-             this.$message.error("导入失败")
1408
+             this.$message.error("导入失败,请下载日志查看")
1463
            }
1409
            }
1464
         })
1410
         })
1465
       },
1411
       },

+ 16 - 57
src/xt_pages/data/components/drugs.vue View File

1270
          console.log("表哥2222",tableData)
1270
          console.log("表哥2222",tableData)
1271
       
1271
       
1272
         var drugType =  this.getDictionaryDataConfig('system','drug_type')
1272
         var drugType =  this.getDictionaryDataConfig('system','drug_type')
1273
-       
1273
+        
1274
        
1274
        
1275
         var drugDosageForm = this.getDictionaryDataConfig('system','drug_dosage_form')
1275
         var drugDosageForm = this.getDictionaryDataConfig('system','drug_dosage_form')
1276
        
1276
        
1287
         var statistics_category = this.getDictionaryDataConfig('system','statistics_category')
1287
         var statistics_category = this.getDictionaryDataConfig('system','statistics_category')
1288
       
1288
       
1289
          
1289
          
1290
-        var drug_category = this.getDictionaryDataConfig('system','drug_category')
1291
-        console.log("药品分类",drug_category)
1290
+        var drugCategory = this.getDictionaryDataConfig('system','drug_category')
1291
+        console.log("药品分类",drugCategory)
1292
+        
1292
         for(let i=0;i<tableData.length;i++){ 
1293
         for(let i=0;i<tableData.length;i++){ 
1293
-          for(let j=0;j<drugType.length;j++){
1294
-            if(tableData[i].drug_type == drugType[j].name){
1295
-                tableData[i].drug_type_id = drugType[j].id
1296
-             }    
1297
-          }
1298
-
1299
-          for(let j=0;j<drugDosageForm.length;j++){
1300
-            if(tableData[i].drug_dosage_form == drugDosageForm[j].name){
1301
-                tableData[i].drug_dosage_form_id = drugDosageForm[j].id
1302
-            }
1303
-          }
1304
-
1305
-          for(let j=0;j<medicalInsuranceLevel.length;j++){
1306
-            if(tableData[i].medical_insurance_level == medicalInsuranceLevel[j].name){
1307
-                tableData[i].medical_insurance_level_id = medicalInsuranceLevel[j].id
1308
-            }
1309
-          }
1310
-
1311
-          for(let j=0;j<drugClassify.length;j++){
1312
-             if(tableData[i].drug_classify == drugClassify[j].name){
1313
-                tableData[i].drug_classify_id = drugClassify[j].id
1314
-             }
1315
-          } 
1316
-         
1317
-         
1318
-          for(let j=0;j<this.manufacturers.length;j++){
1319
-            if(tableData[i].manufacturer == this.manufacturers[j].manufacturer_name){
1320
-               tableData[i].manufacturer_id = this.manufacturers[j].id
1321
-            }
1322
-          }
1323
-         
1324
-          for(let j=0;j<this.dealer.length;j++){
1325
-            if(tableData[i].dealer == this.dealer[j].dealer_name){
1326
-               tableData[i].dealer_id = this.dealer[j].id
1327
-            }
1328
-          }
1329
-
1330
-          for(let j=0;j<pharmacology_category.length;j++){
1331
-             if(tableData[i].pharmacology_category == pharmacology_category[j].name){
1332
-                tableData[i].pharmacology_category_id = pharmacology_category[j].id  
1333
-             }
1334
-          }
1335
-
1336
-         for(let j=0;j<statistics_category.length;j++){
1337
-            if(tableData[i].statistics_category == statistics_category[j].name){
1338
-                tableData[i].statistics_category_id = statistics_category[j].id
1339
-            }
1340
-         } 
1341
-
1294
+          
1342
          for(let j=0;j<drug_control.length;j++){
1295
          for(let j=0;j<drug_control.length;j++){
1343
            if(tableData[i].drug_control == drug_control[j].name){
1296
            if(tableData[i].drug_control == drug_control[j].name){
1344
                tableData[i].drug_control_id = drug_control[j].id
1297
                tableData[i].drug_control_id = drug_control[j].id
1391
               tableData[i].hosp_appr_flag = 3
1344
               tableData[i].hosp_appr_flag = 3
1392
           }
1345
           }
1393
 
1346
 
1394
-          for(let j=0;j<drug_category.length;j++){
1395
-             if(tableData[i].drug_category == drug_category[j].name  ){
1396
-                 tableData[i].drug_category_id = drug_category[j].id
1347
+        if(tableData[i].drug_category !="" && tableData[i].drug_category!=null){
1348
+           for(let j=0;j<drugCategory.length;j++){
1349
+
1350
+             if(tableData[i].drug_category == drugCategory[j].name  ){
1351
+                 tableData[i].drug_category_id = drugCategory[j].id
1352
+             }
1353
+
1354
+              if( tableData[i].drug_category != drugCategory[j].name  ){
1355
+                 tableData[i].drug_category_id = -1
1397
              }
1356
              }
1398
           }
1357
           }
1399
-         
1358
+         }  
1400
         }
1359
         }
1401
        }
1360
        }
1402
        for(let i=0;i<tableData.length;i++){
1361
        for(let i=0;i<tableData.length;i++){
1418
              this.$message.success("导入成功!")
1377
              this.$message.success("导入成功!")
1419
 
1378
 
1420
            }else{
1379
            }else{
1421
-             this.$message.error("导入失败")
1380
+             this.$message.error("导入失败,请下载日志查看")
1422
            }
1381
            }
1423
         })
1382
         })
1424
       },
1383
       },