소스 검색

提交代码

陈少旭 1 년 전
부모
커밋
a9640914e9
1개의 변경된 파일187개의 추가작업 그리고 9개의 파일을 삭제
  1. 187 9
      src/xt_pages/user/inspection.vue

+ 187 - 9
src/xt_pages/user/inspection.vue 파일 보기

@@ -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"
@@ -210,6 +233,67 @@
210 233
       </el-row>
211 234
     </div>
212 235
 
236
+    <el-dialog
237
+      :title="formTitle"
238
+      :visible.sync="dialogRemindFormVisible"
239
+      width="1000px"
240
+      id="user-inspection-form"
241
+    >
242
+      <el-form :model="form" ref="form" label-position="top">
243
+        <el-row>
244
+          <el-col :span="24">
245
+            <el-form-item label="周期提醒: ">
246
+              <el-radio-group v-model="temp_remind_cycle">
247
+                <el-radio :label="1">一月一次</el-radio>
248
+                <el-radio :label="2">两月一次</el-radio>
249
+                <el-radio :label="3">三月一次</el-radio>
250
+                <el-radio :label="4">半年一次</el-radio>
251
+                <el-radio :label="5">一年一次</el-radio>
252
+              </el-radio-group>
253
+            </el-form-item>
254
+          </el-col>
255
+
256
+<!--          <el-col :span="24">-->
257
+<!--            <p style="margin-top:20px;">是否弹窗提醒:-->
258
+<!--              <el-switch v-model="is_open"></el-switch>-->
259
+<!--            </p>-->
260
+<!--          </el-col>-->
261
+        </el-row>
262
+      </el-form>
263
+      <div slot="footer" class="dialog-footer">
264
+        <el-button @click="dialogRemindFormVisible = false">取 消</el-button>
265
+        <el-button
266
+          type="primary"
267
+          @click="submitNewRemind()"
268
+        >保 存
269
+        </el-button
270
+        >
271
+      </div>
272
+    </el-dialog>
273
+
274
+    <el-dialog
275
+      :visible.sync="dialogRemindDialogFormVisible"
276
+      width="1000px"
277
+      id="user-inspection-form"
278
+    >
279
+      <el-col :span="24">
280
+        <p style="margin-top:20px;">是否弹窗提醒:
281
+          <el-switch v-model="is_open"></el-switch>
282
+        </p>
283
+      </el-col>
284
+      <div slot="footer" class="dialog-footer">
285
+        <el-button @click="dialogRemindDialogFormVisible = false">取 消</el-button>
286
+        <el-button
287
+          type="primary"
288
+          @click="submitRemindDialog()"
289
+        >保 存
290
+        </el-button
291
+        >
292
+      </div>
293
+    </el-dialog>
294
+
295
+
296
+
213 297
     <el-dialog
214 298
       :title="formTitle"
215 299
       :visible.sync="dialogFormVisible"
@@ -410,7 +494,9 @@ import {
410 494
   DeletePatientInspection,
411 495
   EditPatientInspection,
412 496
   fetchInspectionReference,
413
-  fetchPatientInspections
497
+  fetchPatientInspections,
498
+  setRemind,
499
+  setRemindDialog
414 500
 } from '@/api/inspection'
415 501
 import { getFileExtension, uParseTime } from '@/utils/tools'
416 502
 
@@ -419,6 +505,9 @@ export default {
419 505
   components: { PatientSidebar, ElImageViewer},
420 506
   data() {
421 507
     return {
508
+      temp_remind_cycle:"",
509
+      is_open:false,
510
+      record_id:0,
422 511
       showViewer:false,
423 512
       imgs:[],
424 513
       total: 0,
@@ -436,6 +525,8 @@ export default {
436 525
       },
437 526
       itemName: '请选择项目',
438 527
       formTitle: '',
528
+      dialogRemindFormVisible:false,
529
+      dialogRemindDialogFormVisible:false,
439 530
       dialogPicFormVisible: false,
440 531
       dialogFormVisible: false,
441 532
       patient_info: null,
@@ -610,8 +701,55 @@ export default {
610 701
         })
611 702
         .catch(() => {
612 703
         })
613
-    },
614
-    openEdit() {
704
+    },submitRemindDialog(){
705
+      var temp_is_open = 0
706
+      if(this.is_open){
707
+        temp_is_open = 1
708
+      }else{
709
+        temp_is_open = 0
710
+      }
711
+      setRemindDialog(this.record_id,temp_is_open).then(response => {
712
+        if (response.data.state == 0) {
713
+          this.$message.error(response.data.msg)
714
+          return false
715
+        } else {
716
+          this.record_id = response.data.data.config.id
717
+          if(response.data.data.config.is_open == 1){
718
+            this.is_open = true
719
+          }else{
720
+            this.is_open = false
721
+          }
722
+          this.$notify({
723
+            title: '成功',
724
+            message: '设置成功',
725
+            type: 'success',
726
+            duration: 2000
727
+          })
728
+          this.dialogRemindDialogFormVisible = false
729
+        }
730
+      })
731
+    },submitNewRemind(){
732
+      // console.log(this.is_open)
733
+      var params = {
734
+        patient: this.patientID,
735
+        project_id: this.project.project_id,
736
+        remind_cycle: this.temp_remind_cycle
737
+      }
738
+      setRemind(params).then(response => {
739
+        if (response.data.state == 0) {
740
+          this.$message.error(response.data.msg)
741
+          return false
742
+        } else {
743
+          this.$notify({
744
+            title: '成功',
745
+            message: '设置成功',
746
+            type: 'success',
747
+            duration: 2000
748
+          })
749
+          this.dialogRemindFormVisible = false
750
+        }
751
+      })
752
+    }, openEdit() {
615 753
 
616 754
       if (this.project == null) {
617 755
         this.$message.error('请先选择项目')
@@ -641,7 +779,11 @@ export default {
641 779
         this.form.project_id = this.project.project_id
642 780
         this.form.inspect_date = this.itemDate
643 781
         this.form.old_inspect_date = this.itemDate
644
-        this.form.remind_cycle = this.patient_info.remind_cycle
782
+        if(this.form.project_id == 14) {
783
+          this.form.remind_cycle = this.patient_info.remind_cycle
784
+        }else{
785
+          this.form.remind_cycle =""
786
+        }
645 787
         console.log(this.form.remind_cycle)
646 788
 
647 789
         this.form.formItem = []
@@ -664,8 +806,15 @@ export default {
664 806
 
665 807
       }
666 808
 
667
-    },
668
-    openPic() {
809
+    },setRemindDialog(){
810
+      this.dialogRemindDialogFormVisible = true
811
+
812
+
813
+    },setRemind(){
814
+      this.dialogRemindFormVisible = true
815
+      // this.temp_remind_cycle = this.
816
+
817
+    },openPic() {
669 818
       if (this.project == null) {
670 819
         this.$message.error('请先选择项目')
671 820
         return false
@@ -676,7 +825,9 @@ export default {
676 825
       this.form.project_id = this.project.project_id
677 826
       this.form.imgs=[]
678 827
       this.form.delete_imgs=[]
679
-      this.form.remind_cycle = this.patient_info.remind_cycle
828
+      if(this.form.project_id == 14) {
829
+        this.form.remind_cycle = this.patient_info.remind_cycle
830
+      }
680 831
       var today = new Date()
681 832
       this.form.inspect_date = uParseTime(today, '{y}-{m}-{d} {h}:{i}')
682 833
       this.form.formItem = []
@@ -713,7 +864,10 @@ export default {
713 864
       this.form.method = 'add'
714 865
       this.formTitle = '新增' + this.project.project_name
715 866
       this.form.project_id = this.project.project_id
716
-      this.form.remind_cycle = this.patient_info.remind_cycle
867
+      if(this.form.project_id == 14) {
868
+        this.form.remind_cycle = this.patient_info.remind_cycle
869
+      }
870
+      // this.form.remind_cycle = this.patient_info.remind_cycle
717 871
       var today = new Date()
718 872
       this.form.inspect_date = uParseTime(today, '{y}-{m}-{d} {h}:{i}')
719 873
       this.form.formItem = []
@@ -1049,7 +1203,8 @@ export default {
1049 1203
             this.projects = reference
1050 1204
             this.patient_info = patient_info
1051 1205
             this.pageLoading = false
1052
-            this.form.remind_cycle = this.patient_info.remind_cycle
1206
+
1207
+            // this.form.remind_cycle = this.patient_info.remind_cycle
1053 1208
           } else {
1054 1209
             this.$message.error(response.data.msg)
1055 1210
             return false
@@ -1099,6 +1254,29 @@ export default {
1099 1254
             var inspections = response.data.data.inspections
1100 1255
             this.total = response.data.data.total
1101 1256
             this.itemDate = response.data.data.date
1257
+            let remind = response.data.data.remind
1258
+
1259
+            let config = response.data.data.config
1260
+            this.record_id = config.id
1261
+            if(config.id > 0){
1262
+
1263
+              if(config.is_open == 1){
1264
+                this.is_open = true
1265
+              }else{
1266
+                this.is_open = false
1267
+
1268
+              }
1269
+            }else{
1270
+              this.is_open = false
1271
+            }
1272
+
1273
+
1274
+            if(remind.id > 0 && remind.remind_cycle > 0){
1275
+              this.temp_remind_cycle = remind.remind_cycle
1276
+            }else{
1277
+              this.temp_remind_cycle = ""
1278
+            }
1279
+
1102 1280
             this.inspections = response.data.data.inspections
1103 1281
             if (inspections == null) {
1104 1282
               this.inspections = []