XMLWAN пре 4 година
родитељ
комит
24afa6bff4

+ 4 - 2
src/xt_pages/stock/selfPreparedMedicine/index.vue Прегледај датотеку

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

+ 8 - 3
src/xt_pages/stock/selfPreparedMedicine/info.vue Прегледај датотеку

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