Browse Source

自备药

XMLWAN 4 years ago
parent
commit
24afa6bff4

+ 4 - 2
src/xt_pages/stock/selfPreparedMedicine/index.vue View File

@@ -95,7 +95,7 @@
95 95
                         <el-table-column align="center" prop="name" label="操作" width="180">
96 96
                             <template slot-scope="scope">
97 97
                                 <el-button size="mini" type="primary" @click="toDetail(scope.row.drug_name,scope.row.drug_spec,scope.row.patient_id)">明细</el-button>
98
-                                <el-button size="mini" type="danger" @click="DeleteDrugName(scope.row.drug_name,scope.row.patient_id)">删除</el-button>
98
+                                <el-button size="mini" type="danger" @click="DeleteDrugName(scope.row.id,scope.row.drug_name,scope.row.patient_id,scope.$index)">删除</el-button>
99 99
                             </template>
100 100
                         </el-table-column>
101 101
                     </el-table>
@@ -256,7 +256,7 @@ export default {
256 256
               }
257 257
           })  
258 258
         },
259
-        DeleteDrugName(name,patientid){
259
+        DeleteDrugName(id,name,patientid,index){
260 260
             this.$confirm('确认删除吗?', '删除', {
261 261
             confirmButtonText: '确 定',
262 262
             cancelButtonText: '取 消',
@@ -264,9 +264,11 @@ export default {
264 264
          })
265 265
           .then(() => {
266 266
               const params = {
267
+                id:id,
267 268
                 drugname:name,
268 269
                 patientid:patientid
269 270
               }
271
+            console.log("params ====",params)
270 272
             DeleteDrugName(params).then(response => {
271 273
               if (response.data.state == 1) {
272 274
                   var msg = response.data.data.msg

+ 8 - 3
src/xt_pages/stock/selfPreparedMedicine/info.vue View File

@@ -32,7 +32,7 @@
32 32
                         </el-table-column>
33 33
                         <el-table-column align="center" prop="name" label="操作" width="80">
34 34
                             <template slot-scope="scope">
35
-                                <el-button size="mini" type="danger" @click="DeleteDrugById(scope.row.id,scope.row.drug_name)">删除</el-button>
35
+                                <el-button size="mini" type="danger" @click="DeleteDrugById(scope.row.id,scope.row.drug_name,scope.$index)">删除</el-button>
36 36
                             </template>
37 37
                         </el-table-column>
38 38
                     </el-table>
@@ -336,6 +336,7 @@ export default {
336 336
           getAllDrugName().then(response=>{
337 337
              if(response.data.state == 1){
338 338
                var drugName  = response.data.data.drugName
339
+               console.log("drugName====",drugName)
339 340
                this.drugName = drugName
340 341
 
341 342
              }
@@ -359,7 +360,7 @@ export default {
359 360
          this.editRuleDialogVisible = false
360 361
        },
361 362
        saveDrugName(){
362
-           var name = ""
363
+           var name = "";
363 364
            for(let i=0;i<this.drugName.length;i++){
364 365
              if(this.drugName[i].id == this.drug_name){
365 366
                 name = this.drugName[i].drug_name
@@ -367,6 +368,7 @@ export default {
367 368
            }
368 369
            const params = {
369 370
               drug_name:name,
371
+              id:this.drug_name,
370 372
            }
371 373
          saveDrugName(params).then(response=>{
372 374
             if(response.data.state == 1){
@@ -384,10 +386,12 @@ export default {
384 386
            for(let i=0;i<this.drugName.length;i++){
385 387
              if(this.drugName[i].id == this.drug_name){
386 388
                 name = this.drugName[i].drug_name
389
+                
387 390
              }
388 391
            }
389 392
            const params = {
390 393
               drug_name:name,
394
+               id:this.drug_name
391 395
            }
392 396
          saveDrugName(params).then(response=>{
393 397
             if(response.data.state == 1){
@@ -543,7 +547,7 @@ export default {
543 547
          })
544 548
        },
545 549
 
546
-       DeleteDrugById(id,drugname){
550
+       DeleteDrugById(id,drugname,index){
547 551
          this.$confirm('确认删除吗?', '删除', {
548 552
           confirmButtonText: '确 定',
549 553
           cancelButtonText: '取 消',
@@ -557,6 +561,7 @@ export default {
557 561
             DeleteDrugById(params).then(response => {
558 562
               if (response.data.state == 1) {
559 563
                   var msg = response.data.data.msg
564
+                  this.tableData.splice(index,1)
560 565
                   this.$message.success("删除成功",msg)
561 566
               } else {
562 567
                   this.$message.error("该药品名称下有药品规格,不能删除")