Commit b20192d5 by lichengming

修改了试验项目接口

parent 8f5d5e77
......@@ -10,7 +10,7 @@ export default {
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('soil/v1/aptitude_exp/' + data).then(res => res),
http.delete('soil/v1/aptitude_exp/?ids=' + data).then(res => res),
// 保存
save: data => http.post('soil/v1/aptitude_exp/', data).then(res => res),
edit: data =>
......@@ -19,7 +19,7 @@ export default {
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),
http.delete('soil/v1/exp_item/?ids=' + 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),
......
......@@ -221,6 +221,7 @@ export default {
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
console.log(ids)
this._delete(ids)
}
})
......@@ -261,8 +262,6 @@ export default {
_getById: async function(id) {
const result = await soilAptitude.getById(id)
console.log('编辑结果')
console.log(result)
if (result) {
this.$refs.editModal._open(result)
}
......
......@@ -41,6 +41,7 @@ export default {
components: { IndexManageEdit },
data() {
return {
id: '',
modalTitle: '',
showModal: false,
btn: [
......@@ -72,10 +73,11 @@ export default {
},
methods: {
_open(data) {
console.log(data)
this.aptitudeItemInfo = data
this.formObj = this.$resetFields(this.formObj)
this.formObj.aptitudeItemId = data.id
this.modalTitle = data.testBasis + ' ' + data.name + ' 指标管理'
this.id = data.id
this.modalTitle = data.name + ' 指标管理'
this.showModal = true
this._page()
},
......@@ -117,14 +119,14 @@ export default {
if (edit) {
this._getById(data)
} else {
this.$refs.indexEdit._open()
this.$refs.indexEdit._open(this.id, '')
}
},
_getById: async function(data) {
const result = await soilAptitude.expItemGetById(data.id)
console.log(result)
if (result) {
this.$refs.indexEdit._open(result)
this.$refs.indexEdit._open('', result)
}
},
_btnClick(msg) {
......
......@@ -25,7 +25,7 @@
</Form-item>
<Form-item label="单位" prop="unit" class="width-48">
<Input v-model="formObj.unit"
name="testMethod" placeholder="请输入单位"/>
name="unit" placeholder="请输入单位"/>
</Form-item>
</div>
</Form>
......@@ -158,12 +158,13 @@ export default {
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_open(formObj) {
_open(id, formObj) {
this.formId = 'edit-form'
this._hideLoading()
this.$refs.formObj.resetFields()
if (this.$string(formObj).isEmpty()) {
this.id = ''
this.expId = id
this.modalTitle = '添加试验指标'
} else {
this.hideUserSel = true
......@@ -319,6 +320,7 @@ export default {
if (valid) {
const data = this.$serialize('edit-form')
if (this.$string(this.id).isEmpty()) {
data.expId = this.expId
// 添加
this._save(data)
} else {
......@@ -340,10 +342,7 @@ export default {
}
},
_edit: async function(data) {
const result = await soilAptitude.expItemEdit({
id: this.formObj.id,
obj: data
})
const result = await soilAptitude.expItemEdit(data)
if (result) {
this._resultChange('编辑成功!')
}
......
......@@ -339,7 +339,7 @@ export default {
}
},
_edit: async function(data) {
const result = await soilAptitude.edit({ id: this.formObj.id, obj: data })
const result = await soilAptitude.edit(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