|
@@ -113,6 +113,7 @@
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import SortMixin from '@/mixins/SortMixin'
|
|
import SortMixin from '@/mixins/SortMixin'
|
|
|
|
|
+import request from '@/utils/request'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
mixins: [SortMixin],
|
|
mixins: [SortMixin],
|
|
@@ -143,10 +144,9 @@ export default {
|
|
|
if (this.filters.name) params.name = this.filters.name
|
|
if (this.filters.name) params.name = this.filters.name
|
|
|
if (this.filters.category) params.category = this.filters.category
|
|
if (this.filters.category) params.category = this.filters.category
|
|
|
if (this.sortState.length > 0) params.sort = this.sortState
|
|
if (this.sortState.length > 0) params.sort = this.sortState
|
|
|
- this.$axios.post('/api/health/knowledge/list', params).then(res => {
|
|
|
|
|
- var data = res.data || {}
|
|
|
|
|
- if (data.code === 200) {
|
|
|
|
|
- var rows = data.data || []
|
|
|
|
|
|
|
+ request.post('/api/health/knowledge/list', params).then(res => {
|
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
|
+ var rows = res.data || []
|
|
|
if (this.filters.name) {
|
|
if (this.filters.name) {
|
|
|
rows = rows.filter(function(r) { return r.itemName && r.itemName.indexOf(this.filters.name) >= 0 }.bind(this))
|
|
rows = rows.filter(function(r) { return r.itemName && r.itemName.indexOf(this.filters.name) >= 0 }.bind(this))
|
|
|
}
|
|
}
|
|
@@ -160,6 +160,8 @@ export default {
|
|
|
})
|
|
})
|
|
|
this.categories = cats
|
|
this.categories = cats
|
|
|
this.list = rows
|
|
this.list = rows
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$message.error(res.message || '加载失败')
|
|
|
}
|
|
}
|
|
|
}).finally(() => { this.loading = false })
|
|
}).finally(() => { this.loading = false })
|
|
|
},
|
|
},
|
|
@@ -178,20 +180,20 @@ export default {
|
|
|
}
|
|
}
|
|
|
this.dialog.saving = true
|
|
this.dialog.saving = true
|
|
|
var url = this.dialog.isEdit ? '/api/health/knowledge/update' : '/api/health/knowledge/add'
|
|
var url = this.dialog.isEdit ? '/api/health/knowledge/update' : '/api/health/knowledge/add'
|
|
|
- this.$axios.post(url, this.dialog.form).then(res => {
|
|
|
|
|
- if (res.data.code === 200) {
|
|
|
|
|
|
|
+ request.post(url, this.dialog.form).then(res => {
|
|
|
|
|
+ if (res.code === 200) {
|
|
|
this.$message.success('已保存')
|
|
this.$message.success('已保存')
|
|
|
this.dialog.visible = false
|
|
this.dialog.visible = false
|
|
|
this.fetchList()
|
|
this.fetchList()
|
|
|
} else {
|
|
} else {
|
|
|
- this.$message.error(res.data.message || '保存失败')
|
|
|
|
|
|
|
+ this.$message.error(res.message || '保存失败')
|
|
|
}
|
|
}
|
|
|
}).finally(() => { this.dialog.saving = false })
|
|
}).finally(() => { this.dialog.saving = false })
|
|
|
},
|
|
},
|
|
|
deleteRow(row) {
|
|
deleteRow(row) {
|
|
|
this.$confirm('确认删除"' + row.itemName + '"?', '提示', { confirmButtonText: '删除', cancelButtonText: '取消', type: 'warning' }).then(function() {
|
|
this.$confirm('确认删除"' + row.itemName + '"?', '提示', { confirmButtonText: '删除', cancelButtonText: '取消', type: 'warning' }).then(function() {
|
|
|
- this.$axios.post('/api/health/knowledge/delete', { id: row.id }).then(function(res) {
|
|
|
|
|
- if (res.data.code === 200) {
|
|
|
|
|
|
|
+ request.post('/api/health/knowledge/delete', { id: row.id }).then(function(res) {
|
|
|
|
|
+ if (res.code === 200) {
|
|
|
this.$message.success('已删除')
|
|
this.$message.success('已删除')
|
|
|
this.fetchList()
|
|
this.fetchList()
|
|
|
}
|
|
}
|
|
@@ -200,9 +202,9 @@ export default {
|
|
|
},
|
|
},
|
|
|
importData() {
|
|
importData() {
|
|
|
this.$confirm('将从参考JSON导入知识库数据,是否继续?', '提示', { confirmButtonText: '导入', cancelButtonText: '取消' }).then(function() {
|
|
this.$confirm('将从参考JSON导入知识库数据,是否继续?', '提示', { confirmButtonText: '导入', cancelButtonText: '取消' }).then(function() {
|
|
|
- this.$axios.post('/api/health/knowledge/import', {}).then(function(res) {
|
|
|
|
|
- if (res.data.code === 200) {
|
|
|
|
|
- this.$message.success(res.data.data || '导入完成')
|
|
|
|
|
|
|
+ request.post('/api/health/knowledge/import', {}).then(function(res) {
|
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
|
+ this.$message.success(res.data || '导入完成')
|
|
|
this.fetchList()
|
|
this.fetchList()
|
|
|
}
|
|
}
|
|
|
}.bind(this))
|
|
}.bind(this))
|