Commit 8f5d5e77 by lichengming

修改了试验项目

parent 9dc592b8
...@@ -7,16 +7,21 @@ import http from '../http' ...@@ -7,16 +7,21 @@ import http from '../http'
export default { export default {
// page // page
page: data => http.post('meter/v1/sample/page', data).then(res => res), page: data => http.post('soil/v1/aptitude_exp/page', data).then(res => res),
getById: data => http.get('meter/v1/sample/' + data).then(res => res), getById: data => http.get('soil/v1/aptitude_exp/' + data).then(res => res),
reportPreview: data =>
http
.post('meter/v1/sample/report_preview_login?id=' + data)
.then(res => res),
deleteById: data => deleteById: data =>
http.delete('meter/v1/sample/?ids=' + data).then(res => res), http.delete('soil/v1/aptitude_exp/' + data).then(res => res),
// 保存 // 保存
save: data => save: data => http.post('soil/v1/aptitude_exp/', data).then(res => res),
http.post('meter/v1/sample/add_send_entrust', data).then(res => res), edit: data =>
addSample: data => http.post('meter/v1/sample/', data).then(res => res) http.put('soil/v1/aptitude_exp/' + data.id, data.obj).then(res => res),
// 指标页面
expItemPage: data =>
http.post('soil/v1/exp_item/page', data).then(res => res),
expItemDeleteByIds: data =>
http.delete('soil/v1/exp_item/' + data).then(res => res),
expItemSave: data => http.post('soil/v1/exp_item/', data).then(res => res),
expItemEdit: data =>
http.put('soil/v1/exp_item/' + data.id, data.obj).then(res => res),
expItemGetById: data => http.get('soil/v1/exp_item/' + data).then(res => res)
} }
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
}, },
_page: async function() { _page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams()) Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilAptitude.page(this.formObj) const result = await soilAptitude.expItemPage(this.formObj)
if (result) { if (result) {
console.log(result) console.log(result)
this.getPage = result this.getPage = result
...@@ -115,11 +115,18 @@ export default { ...@@ -115,11 +115,18 @@ export default {
}, },
_editModal(edit, data) { _editModal(edit, data) {
if (edit) { if (edit) {
console.log('编辑') this._getById(data)
} else { } else {
this.$refs.indexEdit._open() this.$refs.indexEdit._open()
} }
}, },
_getById: async function(data) {
const result = await soilAptitude.expItemGetById(data.id)
console.log(result)
if (result) {
this.$refs.indexEdit._open(result)
}
},
_btnClick(msg) { _btnClick(msg) {
switch (msg) { switch (msg) {
case '添加指标': case '添加指标':
...@@ -132,23 +139,24 @@ export default { ...@@ -132,23 +139,24 @@ export default {
}, },
_deleteByIds() { _deleteByIds() {
if (this.selectIds.length === 0) { if (this.selectIds.length === 0) {
this.$msgTip('warning') // this.$msgTip('warning')
this.$message.warning('请至少选择一条记录')
} else { } else {
this.$Modal.confirm({ this.$Modal.confirm({
title: '提示', title: '提示',
content: '确定删除 ' + this.selectIds.length + ' 条记录?', content: '确定删除 ' + this.selectIds.length + ' 条记录?',
onOk: () => { onOk: () => {
this.$store this._delOk(this.selectIds)
.dispatch('FoodAptitudeLimit/deleteByIds', this.selectIds)
.then(() => {
if (this.$store.state.FoodAptitudeLimit.success) {
this.$Message.success('删除成功!')
this._page()
}
})
} }
}) })
} }
},
_delOk: async function(ids) {
const result = await soilAptitude.expItemDeleteByIds(ids)
if (result) {
this.$message.success('删除成功')
this._page()
}
} }
} }
} }
......
...@@ -333,14 +333,17 @@ export default { ...@@ -333,14 +333,17 @@ export default {
}, },
_save: async function(data) { _save: async function(data) {
console.log(data) console.log(data)
const result = await soilAptitude.save(data) const result = await soilAptitude.expItemSave(data)
console.log(result) console.log(result)
if (result) { if (result) {
this._resultChange('添加成功!') this._resultChange('添加成功!')
} }
}, },
_edit: async function(data) { _edit: async function(data) {
const result = await soilAptitude.edit(data) const result = await soilAptitude.expItemEdit({
id: this.formObj.id,
obj: data
})
if (result) { if (result) {
this._resultChange('编辑成功!') this._resultChange('编辑成功!')
} }
......
...@@ -339,7 +339,7 @@ export default { ...@@ -339,7 +339,7 @@ export default {
} }
}, },
_edit: async function(data) { _edit: async function(data) {
const result = await soilAptitude.edit(data) const result = await soilAptitude.edit({ id: this.formObj.id, obj: data })
if (result) { if (result) {
this._resultChange('编辑成功!') this._resultChange('编辑成功!')
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment