1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import {
articleEnable,
deleteArticle,
addArticle,
} from "@/api/operation-management"
const mixin = {
data() {
return {
readOnly: true,
addVisible: false,
deleteVisible: false,
deleteId: "",
form: {
status: 1,
},
}
},
methods: {
// 添加文章
addMedical() {
this.readOnly = false
this.addVisible = true
},
// 查看
viewMedical(data) {
this.readOnly = true
this.form = { ...data }
this.addVisible = true
},
// 编辑医联体
editMedical(data) {
this.readOnly = false
this.form = JSON.parse(JSON.stringify(data))
this.addVisible = true
},
// 启用状态
openChage(data, index) {
console.log(data, index)
let params = {
id: data.id,
status: data.status ? 1 : 0,
}
articleEnable(params).then((res) => {
if (res.code == 1) {
// this.$message.success("保存成功")
this.getArticleList()
}
})
},
resetForm() {
this.$refs["form"].resetFields()
this.form = {
status: 1,
}
},
submitForm(moduleType) {
this.$refs["form"].validate((valid) => {
if (valid) {
addArticle({
...this.form,
moduleType: moduleType,
}).then((res) => {
if (res.code == 1) {
this.addVisible = false
this.$refs["form"].resetFields()
this.form = {
status: 1,
}
this.getArticleList()
}
})
} else {
console.log("error submit!!")
return false
}
})
},
// 删除
deleteFunc(data) {
console.log(data)
this.deleteVisible = true
this.deleteId = data.id
},
// 确认删除
confirmDelete() {
this.deleteVisible = false
deleteArticle(this.deleteId)
.then((res) => {
if (res.code == 1) {
this.$message.success("删除成功")
this.getArticleList()
}
})
.catch(() => {})
},
},
}
export default mixin