Commit b20192d5 by lichengming

修改了试验项目接口

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