[update 功能安全中心] 区分研究组项目组接口
This commit is contained in:
@@ -99,6 +99,7 @@ export default {
|
|||||||
mixins: [JeroListMixin],
|
mixins: [JeroListMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
disableMixinCreated: true,
|
||||||
// 混入post请求删除接口
|
// 混入post请求删除接口
|
||||||
postMethodDel: true,
|
postMethodDel: true,
|
||||||
SafetyCenterProjectTypeEnums,
|
SafetyCenterProjectTypeEnums,
|
||||||
@@ -149,6 +150,13 @@ export default {
|
|||||||
lastQueryParam: {}
|
lastQueryParam: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created () {
|
||||||
|
// 如果有id展示项目组数据接口
|
||||||
|
if (this.$route.query.id) {
|
||||||
|
this.url.list = '/SafetyCenter/projectGroupPage'
|
||||||
|
}
|
||||||
|
this.loadData()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadData(arg) {
|
loadData(arg) {
|
||||||
if (!this.url.list) {
|
if (!this.url.list) {
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ import pick from 'lodash.pick'
|
|||||||
import { httpAction } from '@api/manage'
|
import { httpAction } from '@api/manage'
|
||||||
import SelectPrincipal from '@comp/company/SelectPrincipal'
|
import SelectPrincipal from '@comp/company/SelectPrincipal'
|
||||||
import { addZero } from '@/utils/util'
|
import { addZero } from '@/utils/util'
|
||||||
|
import {SafetyCenterProjectTypeEnums} from '@/enums/commonEnums'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SafetyCenterModule',
|
name: 'SafetyCenterModule',
|
||||||
@@ -109,10 +110,18 @@ export default {
|
|||||||
validateTrigger: 'blur'
|
validateTrigger: 'blur'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 研究组的接口
|
||||||
url: {
|
url: {
|
||||||
add: '/SafetyCenter/add',
|
add: '/SafetyCenter/add',
|
||||||
edit: '/SafetyCenter/edit'
|
edit: '/SafetyCenter/edit'
|
||||||
}
|
},
|
||||||
|
// 项目组的接口
|
||||||
|
projectUrl: {
|
||||||
|
add: '/SafetyCenter/addProjectGroup',
|
||||||
|
edit: '/SafetyCenter/editProjectGroup'
|
||||||
|
},
|
||||||
|
// 项目类型,默认是研究组
|
||||||
|
projectType: SafetyCenterProjectTypeEnums.studyGroup.value
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -121,6 +130,12 @@ export default {
|
|||||||
this.edit({})
|
this.edit({})
|
||||||
},
|
},
|
||||||
edit(record) {
|
edit(record) {
|
||||||
|
// 有id就是项目组
|
||||||
|
if (this.$route.query.id) {
|
||||||
|
this.projectType = SafetyCenterProjectTypeEnums.projectGroup.value
|
||||||
|
} else {
|
||||||
|
this.projectType = SafetyCenterProjectTypeEnums.studyGroup.value
|
||||||
|
}
|
||||||
this.form.resetFields()
|
this.form.resetFields()
|
||||||
// 防止下拉选项出现问题
|
// 防止下拉选项出现问题
|
||||||
record.principalId = record.principalId || undefined
|
record.principalId = record.principalId || undefined
|
||||||
@@ -151,10 +166,12 @@ export default {
|
|||||||
that.confirmLoading = true
|
that.confirmLoading = true
|
||||||
let httpurl = ''
|
let httpurl = ''
|
||||||
let method = 'post'
|
let method = 'post'
|
||||||
|
// 研究组用url,项目组用projectUrl
|
||||||
|
const urlObj = this.projectType === SafetyCenterProjectTypeEnums.studyGroup.value ? this.url : this.projectUrl
|
||||||
if (!this.model.id) {
|
if (!this.model.id) {
|
||||||
httpurl += this.url.add
|
httpurl += urlObj.add
|
||||||
} else {
|
} else {
|
||||||
httpurl += this.url.edit
|
httpurl += urlObj.edit
|
||||||
}
|
}
|
||||||
const formData = Object.assign(this.model, values)
|
const formData = Object.assign(this.model, values)
|
||||||
console.log('表单提交数据', formData)
|
console.log('表单提交数据', formData)
|
||||||
|
|||||||
Reference in New Issue
Block a user