|
@@ -18,81 +18,80 @@
|
18
|
18
|
</template>
|
19
|
19
|
|
20
|
20
|
<script>
|
21
|
|
-import { setTemplateMode } from "@/api/schedule_template/patient"
|
|
21
|
+import { setTemplateMode } from '@/api/schedule_template/patient'
|
22
|
22
|
|
23
|
23
|
export default {
|
24
|
|
- name: "SetUpTemplateDialog",
|
25
|
|
- data() {
|
26
|
|
- return {
|
27
|
|
- visible: false,
|
28
|
|
- form: {
|
29
|
|
- mode: 0,
|
30
|
|
- },
|
31
|
|
- }
|
|
24
|
+ name: 'SetUpTemplateDialog',
|
|
25
|
+ data() {
|
|
26
|
+ return {
|
|
27
|
+ visible: false,
|
|
28
|
+ form: {
|
|
29
|
+ mode: 0
|
|
30
|
+ }
|
|
31
|
+ }
|
|
32
|
+ },
|
|
33
|
+ props: {
|
|
34
|
+ template_mode: {
|
|
35
|
+ type: Object
|
32
|
36
|
},
|
33
|
|
- props: {
|
34
|
|
- template_mode: {
|
35
|
|
- type: Object,
|
36
|
|
- },
|
37
|
|
- origin_mode: {
|
38
|
|
- type: Number,
|
39
|
|
- }
|
|
37
|
+ origin_mode: {
|
|
38
|
+ type: Number
|
|
39
|
+ }
|
|
40
|
+ },
|
|
41
|
+ watch: {
|
|
42
|
+ 'template_mode.mode': function() {
|
|
43
|
+ this.form.mode = this.template_mode.mode
|
|
44
|
+ }
|
|
45
|
+ },
|
|
46
|
+ methods: {
|
|
47
|
+ _close: function(done) {
|
|
48
|
+ this.clear()
|
|
49
|
+ done()
|
40
|
50
|
},
|
41
|
|
- watch: {
|
42
|
|
- "template_mode.mode": function() {
|
43
|
|
- this.form.mode = this.template_mode.mode
|
44
|
|
- }
|
|
51
|
+ clear: function() {
|
|
52
|
+
|
|
53
|
+ },
|
|
54
|
+ show() {
|
|
55
|
+ this.clear()
|
|
56
|
+ this.visible = true
|
45
|
57
|
},
|
46
|
|
- methods: {
|
47
|
|
- _close: function(done) {
|
48
|
|
- this.clear()
|
49
|
|
- done()
|
50
|
|
- },
|
51
|
|
- clear: function() {
|
52
|
|
-
|
53
|
|
- },
|
54
|
|
- show() {
|
55
|
|
- this.clear()
|
56
|
|
- this.visible = true
|
57
|
|
- },
|
58
|
|
- hide() {
|
59
|
|
- this.clear()
|
60
|
|
- this.visible = false
|
61
|
|
- },
|
62
|
|
- saveAction: function() {
|
63
|
|
- var msg = ""
|
64
|
|
- if (this.origin_mode == 0) { // 0 -> 1 或 0 -> 2 直接清除下两周的排班
|
65
|
|
- msg = "开启模板将清除下两周已设置的排班!是否继续开启?"
|
66
|
|
- } else if (this.form.mode == 0) { // 1 -> 0 或 2 -> 0 则不处理排班,但清除所有模板item
|
|
58
|
+ hide() {
|
|
59
|
+ this.clear()
|
|
60
|
+ this.visible = false
|
|
61
|
+ },
|
|
62
|
+ saveAction: function() {
|
|
63
|
+ var msg = ''
|
|
64
|
+ if (this.origin_mode == 0) { // 0 -> 1 或 0 -> 2 直接清除下两周的排班
|
|
65
|
+ msg = '开启模板将清除下两周已设置的排班!是否继续开启?'
|
|
66
|
+ } else if (this.form.mode == 0) { // 1 -> 0 或 2 -> 0 则不处理排班,但清除所有模板item
|
67
|
67
|
|
68
|
|
- } else if (this.origin_mode == 1 && this.form.mode == 2) { // 1 -> 2 清除第二周排班
|
69
|
|
- msg = "开启双周模板将清除下第二周已设置的排班!是否继续开启?"
|
70
|
|
- } else if (this.origin_mode == 2 && this.form.mode == 1) { // 2 -> 1 清除第二周模板item,清除第二周排班,将第一周的排班重复到第二周
|
71
|
|
- msg = "双周模板调整为单周模板时,下第二周排班将被清除,并用单周模板生成下第二周的排班!是否继续调整?"
|
72
|
|
- }
|
73
|
|
- if (msg.length == 0) {
|
74
|
|
- this.submit()
|
75
|
|
- } else {
|
76
|
|
- this.$confirm(msg, '提示', {confirmButtonText: '确 定', cancelButtonText: '取 消', type: 'warning'})
|
77
|
|
- .then(() => {
|
78
|
|
- this.submit()
|
79
|
|
- })
|
80
|
|
- }
|
81
|
|
- },
|
82
|
|
- submit: function() {
|
83
|
|
- setTemplateMode(this.form.mode).then(rs => {
|
84
|
|
- var resp = rs.data
|
85
|
|
- if (resp.state == 1) {
|
86
|
|
- this.template_mode.mode = this.form.mode
|
87
|
|
- this.hide()
|
88
|
|
- this.$emit("chenge_mode", this.form.mode)
|
89
|
|
-
|
90
|
|
- } else {
|
91
|
|
- this.$message.error(resp.msg)
|
92
|
|
- }
|
93
|
|
- })
|
|
68
|
+ } else if (this.origin_mode == 1 && this.form.mode == 2) { // 1 -> 2 清除第二周排班
|
|
69
|
+ msg = '开启双周模板将清除下第二周已设置的排班!是否继续开启?'
|
|
70
|
+ } else if (this.origin_mode == 2 && this.form.mode == 1) { // 2 -> 1 清除第二周模板item,清除第二周排班,将第一周的排班重复到第二周
|
|
71
|
+ msg = '双周模板调整为单周模板时,下第二周排班将被清除,并用单周模板生成下第二周的排班!是否继续调整?'
|
|
72
|
+ }
|
|
73
|
+ if (msg.length == 0) {
|
|
74
|
+ this.submit()
|
|
75
|
+ } else {
|
|
76
|
+ this.$confirm(msg, '提示', { confirmButtonText: '确 定', cancelButtonText: '取 消', type: 'warning' })
|
|
77
|
+ .then(() => {
|
|
78
|
+ this.submit()
|
|
79
|
+ })
|
|
80
|
+ }
|
|
81
|
+ },
|
|
82
|
+ submit: function() {
|
|
83
|
+ setTemplateMode(this.form.mode).then(rs => {
|
|
84
|
+ var resp = rs.data
|
|
85
|
+ if (resp.state == 1) {
|
|
86
|
+ this.template_mode.mode = this.form.mode
|
|
87
|
+ this.hide()
|
|
88
|
+ this.$emit('chenge_mode', this.form.mode)
|
|
89
|
+ } else {
|
|
90
|
+ this.$message.error(resp.msg)
|
94
|
91
|
}
|
|
92
|
+ })
|
95
|
93
|
}
|
|
94
|
+ }
|
96
|
95
|
}
|
97
|
96
|
</script>
|
98
|
97
|
|