Commit 8f5d5e77 by lichengming

修改了试验项目

parent 9dc592b8
......@@ -7,16 +7,21 @@ import http from '../http'
export default {
// page
page: data => http.post('meter/v1/sample/page', data).then(res => res),
getById: data => http.get('meter/v1/sample/' + data).then(res => res),
reportPreview: data =>
http
.post('meter/v1/sample/report_preview_login?id=' + data)
.then(res => res),
page: data => http.post('soil/v1/aptitude_exp/page', data).then(res => res),
getById: data => http.get('soil/v1/aptitude_exp/' + data).then(res => res),
deleteById: data =>
http.delete('meter/v1/sample/?ids=' + data).then(res => res),
http.delete('soil/v1/aptitude_exp/' + data).then(res => res),
// 保存
save: data =>
http.post('meter/v1/sample/add_send_entrust', data).then(res => res),
addSample: data => http.post('meter/v1/sample/', data).then(res => res)
save: data => http.post('soil/v1/aptitude_exp/', data).then(res => res),
edit: data =>
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 {
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilAptitude.page(this.formObj)
const result = await soilAptitude.expItemPage(this.formObj)
if (result) {
console.log(result)
this.getPage = result
......@@ -115,11 +115,18 @@ export default {
},
_editModal(edit, data) {
if (edit) {
console.log('编辑')
this._getById(data)
} else {
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) {
switch (msg) {
case '添加指标':
......@@ -132,23 +139,24 @@ export default {
},
_deleteByIds() {
if (this.selectIds.length === 0) {
this.$msgTip('warning')
// this.$msgTip('warning')
this.$message.warning('请至少选择一条记录')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定删除 ' + this.selectIds.length + ' 条记录?',
onOk: () => {
this.$store
.dispatch('FoodAptitudeLimit/deleteByIds', this.selectIds)
.then(() => {
if (this.$store.state.FoodAptitudeLimit.success) {
this.$Message.success('删除成功!')
this._page()
}
})
this._delOk(this.selectIds)
}
})
}
},
_delOk: async function(ids) {
const result = await soilAptitude.expItemDeleteByIds(ids)
if (result) {
this.$message.success('删除成功')
this._page()
}
}
}
}
......
......@@ -333,14 +333,17 @@ export default {
},
_save: async function(data) {
console.log(data)
const result = await soilAptitude.save(data)
const result = await soilAptitude.expItemSave(data)
console.log(result)
if (result) {
this._resultChange('添加成功!')
}
},
_edit: async function(data) {
const result = await soilAptitude.edit(data)
const result = await soilAptitude.expItemEdit({
id: this.formObj.id,
obj: data
})
if (result) {
this._resultChange('编辑成功!')
}
......
......@@ -339,7 +339,7 @@ export default {
}
},
_edit: async function(data) {
const result = await soilAptitude.edit(data)
const result = await soilAptitude.edit({ id: this.formObj.id, obj: data })
if (result) {
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