陈少旭 1 gadu atpakaļ
vecāks
revīzija
1df81cb336
1 mainītis faili ar 187 papildinājumiem un 9 dzēšanām
  1. 187 9
      src/xt_pages/user/inspection.vue

+ 187 - 9
src/xt_pages/user/inspection.vue Parādīt failu

@@ -40,6 +40,29 @@
40 40
         </el-col>
41 41
         <el-col :span="17" v-loading="itemLoading">
42 42
           <div class="filter-container" style="float:right">
43
+
44
+            <el-button
45
+              size="small"
46
+              class="filter-item"
47
+              type="primary"
48
+              @click="setRemindDialog()"
49
+              v-if="project && project.project_id != 14"
50
+              icon="el-icon-circle-plus-outline"
51
+              :disabled="project ? false : true"
52
+            >设置提醒弹窗
53
+            </el-button>
54
+
55
+            <el-button
56
+              size="small"
57
+              class="filter-item"
58
+              type="primary"
59
+              @click="setRemind()"
60
+              v-if="project && project.project_id != 14"
61
+              icon="el-icon-circle-plus-outline"
62
+              :disabled="project ? false : true"
63
+            >设置提醒周期
64
+            </el-button>
65
+
43 66
             <el-button
44 67
               size="small"
45 68
               class="filter-item"
@@ -196,6 +219,67 @@
196 219
       </el-row>
197 220
     </div>
198 221
 
222
+    <el-dialog
223
+      :title="formTitle"
224
+      :visible.sync="dialogRemindFormVisible"
225
+      width="1000px"
226
+      id="user-inspection-form"
227
+    >
228
+      <el-form :model="form" ref="form" label-position="top">
229
+        <el-row>
230
+          <el-col :span="24">
231
+            <el-form-item label="周期提醒: ">
232
+              <el-radio-group v-model="temp_remind_cycle">
233
+                <el-radio :label="1">一月一次</el-radio>
234
+                <el-radio :label="2">两月一次</el-radio>
235
+                <el-radio :label="3">三月一次</el-radio>
236
+                <el-radio :label="4">半年一次</el-radio>
237
+                <el-radio :label="5">一年一次</el-radio>
238
+              </el-radio-group>
239
+            </el-form-item>
240
+          </el-col>
241
+
242
+          <el-col :span="24">
243
+            <p style="margin-top:20px;">是否弹窗提醒:
244
+              <el-switch v-model="is_open"></el-switch>
245
+            </p>
246
+          </el-col>
247
+        </el-row>
248
+      </el-form>
249
+      <div slot="footer" class="dialog-footer">
250
+        <el-button @click="dialogRemindFormVisible = false">取 消</el-button>
251
+        <el-button
252
+          type="primary"
253
+          @click="submitNewRemind()"
254
+        >保 存
255
+        </el-button
256
+        >
257
+      </div>
258
+    </el-dialog>
259
+
260
+    <el-dialog
261
+      :visible.sync="dialogRemindDialogFormVisible"
262
+      width="1000px"
263
+      id="user-inspection-form"
264
+    >
265
+      <el-col :span="24">
266
+        <p style="margin-top:20px;">是否弹窗提醒:
267
+          <el-switch v-model="is_open"></el-switch>
268
+        </p>
269
+      </el-col>
270
+      <div slot="footer" class="dialog-footer">
271
+        <el-button @click="dialogRemindDialogFormVisible = false">取 消</el-button>
272
+        <el-button
273
+          type="primary"
274
+          @click="submitRemindDialog()"
275
+        >保 存
276
+        </el-button
277
+        >
278
+      </div>
279
+    </el-dialog>
280
+
281
+
282
+
199 283
     <el-dialog
200 284
       :title="formTitle"
201 285
       :visible.sync="dialogFormVisible"
@@ -216,7 +300,6 @@
216 300
               </el-radio-group>
217 301
             </el-form-item>
218 302
           </el-col>
219
-
220 303
           <el-col :span="7">
221 304
             <el-form-item
222 305
               label="检验日期"
@@ -390,7 +473,9 @@ import {
390 473
   DeletePatientInspection,
391 474
   EditPatientInspection,
392 475
   fetchInspectionReference,
393
-  fetchPatientInspections
476
+  fetchPatientInspections,
477
+  setRemind,
478
+  setRemindDialog
394 479
 } from '@/api/inspection'
395 480
 import { getFileExtension, uParseTime } from '@/utils/tools'
396 481
 
@@ -399,6 +484,9 @@ export default {
399 484
   components: { PatientSidebar },
400 485
   data() {
401 486
     return {
487
+      temp_remind_cycle:"",
488
+      is_open:false,
489
+      record_id:0,
402 490
       total: 0,
403 491
       qiniuDomain: 'https://images.shengws.com/',
404 492
       isPic:false,
@@ -414,6 +502,8 @@ export default {
414 502
       },
415 503
       itemName: '请选择项目',
416 504
       formTitle: '',
505
+      dialogRemindFormVisible:false,
506
+      dialogRemindDialogFormVisible:false,
417 507
       dialogPicFormVisible: false,
418 508
       dialogFormVisible: false,
419 509
       patient_info: null,
@@ -579,8 +669,55 @@ export default {
579 669
         })
580 670
         .catch(() => {
581 671
         })
582
-    },
583
-    openEdit() {
672
+    },submitRemindDialog(){
673
+      var temp_is_open = 0
674
+      if(this.is_open){
675
+        temp_is_open = 1
676
+      }else{
677
+        temp_is_open = 0
678
+      }
679
+      setRemindDialog(this.record_id,temp_is_open).then(response => {
680
+        if (response.data.state == 0) {
681
+          this.$message.error(response.data.msg)
682
+          return false
683
+        } else {
684
+          this.record_id = response.data.data.config.id
685
+          if(response.data.data.config.is_open == 1){
686
+            this.is_open = true
687
+          }else{
688
+            this.is_open = false
689
+          }
690
+          this.$notify({
691
+            title: '成功',
692
+            message: '设置成功',
693
+            type: 'success',
694
+            duration: 2000
695
+          })
696
+          this.dialogRemindDialogFormVisible = false
697
+        }
698
+      })
699
+    },submitNewRemind(){
700
+      // console.log(this.is_open)
701
+      var params = {
702
+        patient: this.patientID,
703
+        project_id: this.project.project_id,
704
+        remind_cycle: this.temp_remind_cycle
705
+      }
706
+      setRemind(params).then(response => {
707
+        if (response.data.state == 0) {
708
+          this.$message.error(response.data.msg)
709
+          return false
710
+        } else {
711
+          this.$notify({
712
+            title: '成功',
713
+            message: '设置成功',
714
+            type: 'success',
715
+            duration: 2000
716
+          })
717
+          this.dialogRemindFormVisible = false
718
+        }
719
+      })
720
+    }, openEdit() {
584 721
 
585 722
       if (this.project == null) {
586 723
         this.$message.error('请先选择项目')
@@ -610,7 +747,11 @@ export default {
610 747
         this.form.project_id = this.project.project_id
611 748
         this.form.inspect_date = this.itemDate
612 749
         this.form.old_inspect_date = this.itemDate
613
-        this.form.remind_cycle = this.patient_info.remind_cycle
750
+        if(this.form.project_id == 14) {
751
+          this.form.remind_cycle = this.patient_info.remind_cycle
752
+        }else{
753
+          this.form.remind_cycle =""
754
+        }
614 755
         console.log(this.form.remind_cycle)
615 756
 
616 757
         this.form.formItem = []
@@ -633,7 +774,15 @@ export default {
633 774
 
634 775
       }
635 776
 
636
-    }, openPic() {
777
+    },setRemindDialog(){
778
+      this.dialogRemindDialogFormVisible = true
779
+
780
+
781
+    },setRemind(){
782
+      this.dialogRemindFormVisible = true
783
+      // this.temp_remind_cycle = this.
784
+
785
+    },openPic() {
637 786
       if (this.project == null) {
638 787
         this.$message.error('请先选择项目')
639 788
         return false
@@ -644,7 +793,9 @@ export default {
644 793
       this.form.project_id = this.project.project_id
645 794
       this.form.imgs=[]
646 795
       this.form.delete_imgs=[]
647
-      this.form.remind_cycle = this.patient_info.remind_cycle
796
+      if(this.form.project_id == 14) {
797
+        this.form.remind_cycle = this.patient_info.remind_cycle
798
+      }
648 799
       var today = new Date()
649 800
       this.form.inspect_date = uParseTime(today, '{y}-{m}-{d} {h}:{i}')
650 801
       this.form.formItem = []
@@ -681,7 +832,10 @@ export default {
681 832
       this.form.method = 'add'
682 833
       this.formTitle = '新增' + this.project.project_name
683 834
       this.form.project_id = this.project.project_id
684
-      this.form.remind_cycle = this.patient_info.remind_cycle
835
+      if(this.form.project_id == 14) {
836
+        this.form.remind_cycle = this.patient_info.remind_cycle
837
+      }
838
+      // this.form.remind_cycle = this.patient_info.remind_cycle
685 839
       var today = new Date()
686 840
       this.form.inspect_date = uParseTime(today, '{y}-{m}-{d} {h}:{i}')
687 841
       this.form.formItem = []
@@ -1015,7 +1169,8 @@ export default {
1015 1169
             this.projects = reference
1016 1170
             this.patient_info = patient_info
1017 1171
             this.pageLoading = false
1018
-            this.form.remind_cycle = this.patient_info.remind_cycle
1172
+
1173
+            // this.form.remind_cycle = this.patient_info.remind_cycle
1019 1174
           } else {
1020 1175
             this.$message.error(response.data.msg)
1021 1176
             return false
@@ -1065,6 +1220,29 @@ export default {
1065 1220
             var inspections = response.data.data.inspections
1066 1221
             this.total = response.data.data.total
1067 1222
             this.itemDate = response.data.data.date
1223
+            let remind = response.data.data.remind
1224
+
1225
+            let config = response.data.data.config
1226
+            this.record_id = config.id
1227
+            if(config.id > 0){
1228
+
1229
+              if(config.is_open == 1){
1230
+                this.is_open = true
1231
+              }else{
1232
+                this.is_open = false
1233
+
1234
+              }
1235
+            }else{
1236
+              this.is_open = false
1237
+            }
1238
+
1239
+
1240
+            if(remind.id > 0 && remind.remind_cycle > 0){
1241
+              this.temp_remind_cycle = remind.remind_cycle
1242
+            }else{
1243
+              this.temp_remind_cycle = ""
1244
+            }
1245
+
1068 1246
             this.inspections = response.data.data.inspections
1069 1247
             if (inspections == null) {
1070 1248
               this.inspections = []